import * as React from 'react';
import { getRuleDetails } from '../../../api/rules';
import { getSecurityHotspotDetails } from '../../../api/security-hotspots';
-import { scrollToElement } from '../../../helpers/scrolling';
import {
Hotspot,
HotspotStatusFilter,
showStatusUpdateSuccessModal: boolean;
}
-const SCROLL_TO_COMMENT_BOTTOM_OFFSET = 300;
-
export default class HotspotViewer extends React.PureComponent<Props, State> {
mounted = false;
state: 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 });
}
};