[Glitch] Fix page incorrectly scrolling when bringing up dropdown menus
Port 77ec0875ea
to glitch-soc
Signed-off-by: Thibaut Girka <thib@sitedethib.com>
remotes/1727458204337373841/tmp_refs/heads/signup-info-prompt
parent
9e5a216878
commit
7ea8b07b93
|
@ -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 });
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,9 +64,9 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent
|
||||||
document.addEventListener('click', this.handleDocumentClick, false);
|
document.addEventListener('click', this.handleDocumentClick, false);
|
||||||
document.addEventListener('touchend', this.handleDocumentClick, withPassive);
|
document.addEventListener('touchend', this.handleDocumentClick, withPassive);
|
||||||
if (this.focusedItem) {
|
if (this.focusedItem) {
|
||||||
this.focusedItem.focus();
|
this.focusedItem.focus({ preventScroll: true });
|
||||||
} else {
|
} else {
|
||||||
this.node.firstChild.focus();
|
this.node.firstChild.focus({ preventScroll: true });
|
||||||
}
|
}
|
||||||
this.setState({ mounted: true });
|
this.setState({ mounted: true });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue