Fix page incorrectly scrolling when bringing up dropdown menus

This commit is contained in:
Thibaut Girka 2021-08-28 15:38:51 +02:00 committed by marcin mikołajczak
parent 7b7808defe
commit 9b879b6931
2 changed files with 2 additions and 2 deletions

View File

@ -46,7 +46,7 @@ class DropdownMenu extends React.PureComponent {
document.addEventListener('keydown', this.handleKeyDown, false); document.addEventListener('keydown', this.handleKeyDown, false);
document.addEventListener('touchend', this.handleDocumentClick, listenerOptions); document.addEventListener('touchend', this.handleDocumentClick, listenerOptions);
if (this.focusedItem && this.props.openedViaKeyboard) { if (this.focusedItem && this.props.openedViaKeyboard) {
this.focusedItem.focus(); this.focusedItem.focus({ preventScroll: true });
} }
this.setState({ mounted: true }); this.setState({ mounted: true });
} }

View File

@ -100,7 +100,7 @@ class PrivacyDropdownMenu extends React.PureComponent {
componentDidMount() { componentDidMount() {
document.addEventListener('click', this.handleDocumentClick, false); document.addEventListener('click', this.handleDocumentClick, false);
document.addEventListener('touchend', this.handleDocumentClick, listenerOptions); document.addEventListener('touchend', this.handleDocumentClick, listenerOptions);
if (this.focusedItem) this.focusedItem.focus(); if (this.focusedItem) this.focusedItem.focus({ preventScroll: true });
this.setState({ mounted: true }); this.setState({ mounted: true });
} }