diff options
author | Jeremy Davis <jeremy.davis@sonarsource.com> | 2021-11-04 15:51:13 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2021-11-04 20:03:25 +0000 |
commit | c8fdeae6c3ce695ca3e3ce448cbd917124a27646 (patch) | |
tree | 7aac7592920082eb9a63364edc2188fdff159ef2 | |
parent | 30a4e0e9c9916a76b068268a3d225b3c45784b97 (diff) | |
download | sonarqube-c8fdeae6c3ce695ca3e3ce448cbd917124a27646.tar.gz sonarqube-c8fdeae6c3ce695ca3e3ce448cbd917124a27646.zip |
SONAR-15575 Fix keyboard navigation in hotspots page
-rw-r--r-- | server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewer.tsx | 7 |
1 files changed, 3 insertions, 4 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 300d2e53178..6751bb68ab7 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 @@ -46,6 +46,8 @@ interface State { showStatusUpdateSuccessModal: boolean; } +const SCROLL_TO_COMMENT_BOTTOM_OFFSET = 300; + export default class HotspotViewer extends React.PureComponent<Props, State> { mounted = false; state: State; @@ -66,9 +68,6 @@ export default class HotspotViewer extends React.PureComponent<Props, State> { if (prevProps.hotspotKey !== this.props.hotspotKey) { this.fetchHotspot(); } - if (this.commentTextRef.current) { - this.commentTextRef.current.focus({ preventScroll: true }); - } } componentWillUnmount() { @@ -102,7 +101,7 @@ export default class HotspotViewer extends React.PureComponent<Props, State> { if (this.commentTextRef.current) { this.commentTextRef.current.focus({ preventScroll: true }); scrollToElement(this.commentTextRef.current, { - bottomOffset: 100 + bottomOffset: SCROLL_TO_COMMENT_BOTTOM_OFFSET }); } }; |