import * as React from 'react';
import { RuleDescriptionSection } from '../../apps/coding-rules/rule';
import { translate } from '../../helpers/l10n';
-import { scrollToElement } from '../../helpers/scrolling';
import { Dict } from '../../types/types';
import { ButtonLink } from '../controls/buttons';
import { Alert } from '../ui/Alert';
handleNotificationScroll = () => {
const element = this.props.educationPrinciplesRef?.current;
if (element) {
- scrollToElement(element, { topOffset: 20, bottomOffset: 250 });
+ element.scrollIntoView();
}
};
return null;
}
return (
- <div key={key} className="education-principles rule-desc">
+ <div key={key} className="education-principles rule-desc big-padded">
<Concept />
</div>
);
};
this.educationPrinciplesRef = React.createRef();
this.checkIfConceptIsVisible = debounce(this.checkIfConceptIsVisible, DEBOUNCE_FOR_SCROLL);
- document.addEventListener('scroll', this.checkIfConceptIsVisible);
+ document.addEventListener('scroll', this.checkIfConceptIsVisible, { capture: true });
}
componentDidMount() {
}
componentWillUnmount() {
- document.removeEventListener('scroll', this.checkIfConceptIsVisible);
+ document.removeEventListener('scroll', this.checkIfConceptIsVisible, { capture: true });
}
checkIfConceptIsVisible = () => {
if (isView && this.showNotification) {
dismissNotification(NoticeType.EDUCATION_PRINCIPLES)
.then(() => {
- document.removeEventListener('scroll', this.checkIfConceptIsVisible);
+ document.removeEventListener('scroll', this.checkIfConceptIsVisible, { capture: true });
this.showNotification = false;
})
.catch(() => {