]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Fix page incorrectly scrolling when bringing up dropdown menus
authorThibG <thib@sitedethib.com>
Tue, 28 Apr 2020 11:19:39 +0000 (13:19 +0200)
committerThibaut Girka <thib@sitedethib.com>
Sun, 3 May 2020 19:47:11 +0000 (21:47 +0200)
Port 77ec0875ea998072f4bb709bfb9b15e80669eeef 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_menu.js

index b3da4fc2f76686db8e3b493cf3f7825a5c6e8ac5..60ed859a3f4595b8e2fb89344500f9b75240ed95 100644 (file)
@@ -46,7 +46,7 @@ class DropdownMenu extends React.PureComponent {
     document.addEventListener('keydown', this.handleKeyDown, false);
     document.addEventListener('touchend', this.handleDocumentClick, listenerOptions);
     if (this.focusedItem && this.props.openedViaKeyboard) {
-      this.focusedItem.focus();
+      this.focusedItem.focus({ preventScroll: true });
     }
     this.setState({ mounted: true });
   }
index 84c040a86b21fbf77c280b35ca0b70a94854fd0e..bee06e64c7f5589b54dde469a1410208f00468be 100644 (file)
@@ -64,9 +64,9 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent
     document.addEventListener('click', this.handleDocumentClick, false);
     document.addEventListener('touchend', this.handleDocumentClick, withPassive);
     if (this.focusedItem) {
-      this.focusedItem.focus();
+      this.focusedItem.focus({ preventScroll: true });
     } else {
-      this.node.firstChild.focus();
+      this.node.firstChild.focus({ preventScroll: true });
     }
     this.setState({ mounted: true });
   }