Browse Source

SONAR-15575 Fix keyboard navigation in hotspots page

tags/9.2.0.49834
Jeremy Davis 2 years ago
parent
commit
c8fdeae6c3

+ 3
- 4
server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewer.tsx View File

@@ -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
});
}
};

Loading…
Cancel
Save