]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-18771 Fix unstable test assign_hotspot_to_someone_else
authorstanislavh <stanislav.honcharov@sonarsource.com>
Tue, 14 Mar 2023 12:52:31 +0000 (13:52 +0100)
committerLukasz Jarocki <lukasz.jarocki@sonarsource.com>
Fri, 17 Mar 2023 09:45:57 +0000 (10:45 +0100)
server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewer.tsx

index eb33c6acaebf70689d0e8639122fe7d0504f89cb..f02dcb8483bf5914911231b991192deaeb462886 100644 (file)
@@ -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<Props, State> {
   mounted = false;
   state: State;
@@ -110,10 +107,12 @@ export default class HotspotViewer extends React.PureComponent<Props, State> {
 
   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 });
     }
   };