From: stanislavh Date: Tue, 14 Mar 2023 12:52:31 +0000 (+0100) Subject: SONAR-18771 Fix unstable test assign_hotspot_to_someone_else X-Git-Tag: 10.0.0.68432~136 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c95343aa713ab29493681d71bc8e74c847ffe8ca;p=sonarqube.git SONAR-18771 Fix unstable test assign_hotspot_to_someone_else --- 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 }); } };