]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Fix scrolling issues when closing some dropdown menus
authorThibG <thib@sitedethib.com>
Fri, 21 Aug 2020 12:14:28 +0000 (14:14 +0200)
committerThibaut Girka <thib@sitedethib.com>
Sun, 30 Aug 2020 14:31:02 +0000 (16:31 +0200)
Port c7cfd4e67aedb38cba3ee452e18bd086e30e2e5d to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
app/javascript/flavours/glitch/components/dropdown_menu.js
app/javascript/flavours/glitch/features/compose/components/dropdown.js

index 60ed859a3f4595b8e2fb89344500f9b75240ed95..e627ea51fdd85d45557adcce9cf48ffb353b37b8 100644 (file)
@@ -205,7 +205,7 @@ export default class Dropdown extends React.PureComponent {
 
   handleClose = () => {
     if (this.activeElement) {
-      this.activeElement.focus();
+      this.activeElement.focus({ preventScroll: true });
       this.activeElement = null;
     }
     this.props.onClose(this.state.id);
index 60035b7057737291e707e154a6c419f609d2a1de..04ef3964b2a8ce4910187fe34339b17dd50b044a 100644 (file)
@@ -57,7 +57,7 @@ export default class ComposerOptionsDropdown extends React.PureComponent {
     } else {
       const { top } = target.getBoundingClientRect();
       if (this.state.open && this.activeElement) {
-        this.activeElement.focus();
+        this.activeElement.focus({ preventScroll: true });
       }
       this.setState({ placement: top * 2 < innerHeight ? 'bottom' : 'top' });
       this.setState({ open: !this.state.open, openedViaKeyboard: type !== 'click' });
@@ -100,7 +100,7 @@ export default class ComposerOptionsDropdown extends React.PureComponent {
 
   handleClose = () => {
     if (this.state.open && this.activeElement) {
-      this.activeElement.focus();
+      this.activeElement.focus({ preventScroll: true });
     }
     this.setState({ open: false });
   }