]> cat aescling's git repositories - mastodon.git/commitdiff
Fix scrolling issues when closing some dropdown menus (#14606)
authorThibG <thib@sitedethib.com>
Fri, 21 Aug 2020 12:14:28 +0000 (14:14 +0200)
committerGitHub <noreply@github.com>
Fri, 21 Aug 2020 12:14:28 +0000 (14:14 +0200)
app/javascript/mastodon/components/dropdown_menu.js
app/javascript/mastodon/features/compose/components/privacy_dropdown.js

index 4734e0f3fc4a6c09729984e3bd0af272ce58c527..09e3c9df85936bd4aaf1b62bdc4dff1108a523a8 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 96028e0421f164fbf399babe2bdcd7daa195d610..5223025fb5f412a27b9e7a1236c3e8329c1636e5 100644 (file)
@@ -179,7 +179,7 @@ class PrivacyDropdown 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 });
@@ -220,7 +220,7 @@ class PrivacyDropdown extends React.PureComponent {
 
   handleClose = () => {
     if (this.state.open && this.activeElement) {
-      this.activeElement.focus();
+      this.activeElement.focus({ preventScroll: true });
     }
     this.setState({ open: false });
   }