From c95343aa713ab29493681d71bc8e74c847ffe8ca Mon Sep 17 00:00:00 2001 From: stanislavh Date: Tue, 14 Mar 2023 13:52:31 +0100 Subject: [PATCH] SONAR-18771 Fix unstable test assign_hotspot_to_someone_else --- .../security-hotspots/components/HotspotViewer.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewer.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewer.tsx index eb33c6acaeb..f02dcb8483b 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewer.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewer.tsx @@ -20,7 +20,6 @@ import * as React from 'react'; import { getRuleDetails } from '../../../api/rules'; import { getSecurityHotspotDetails } from '../../../api/security-hotspots'; -import { scrollToElement } from '../../../helpers/scrolling'; import { Hotspot, HotspotStatusFilter, @@ -49,8 +48,6 @@ interface State { showStatusUpdateSuccessModal: boolean; } -const SCROLL_TO_COMMENT_BOTTOM_OFFSET = 300; - export default class HotspotViewer extends React.PureComponent { mounted = false; state: State; @@ -110,10 +107,12 @@ export default class HotspotViewer extends React.PureComponent { handleScrollToCommentForm = () => { if (this.commentTextRef.current) { - this.commentTextRef.current.focus({ preventScroll: true }); - scrollToElement(this.commentTextRef.current, { - bottomOffset: SCROLL_TO_COMMENT_BOTTOM_OFFSET, + this.commentTextRef.current.scrollIntoView({ + block: 'center', + behavior: 'smooth', + inline: 'center', }); + this.commentTextRef.current.focus({ preventScroll: true }); } }; -- 2.39.5