aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstanislavh <stanislav.honcharov@sonarsource.com>2023-03-14 13:52:31 +0100
committerLukasz Jarocki <lukasz.jarocki@sonarsource.com>2023-03-17 10:45:57 +0100
commitc95343aa713ab29493681d71bc8e74c847ffe8ca (patch)
tree54412d5b0d81af2315bd4de1d3c84078f6d1afab
parentdaec2c376e834360f0a2640da2072063458ec244 (diff)
downloadsonarqube-c95343aa713ab29493681d71bc8e74c847ffe8ca.tar.gz
sonarqube-c95343aa713ab29493681d71bc8e74c847ffe8ca.zip
SONAR-18771 Fix unstable test assign_hotspot_to_someone_else
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewer.tsx11
1 files 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<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 });
}
};