about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/compose/components/privacy_dropdown.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-04-28 13:19:39 +0200
committerGitHub <noreply@github.com>2020-04-28 13:19:39 +0200
commit77ec0875ea998072f4bb709bfb9b15e80669eeef (patch)
tree26d089ff3ef3590d720b3dd7e7b826805f9667c6 /app/javascript/mastodon/features/compose/components/privacy_dropdown.js
parentf70a54b34cf892fc919c7c304b35bcc360311999 (diff)
Fix page incorrectly scrolling when bringing up dropdown menus (#13574)
Fixes #13573

For some reason (I suspect this may be related to focusing the item before it
got drown by the browser), Firefox scrolls to top when bringing up dropdown
menus with pre-selected items.

This commit uses the “preventScroll” option as, due to the placement behavior,
the menu should be visible anyway and not trigger scrolling.
Diffstat (limited to 'app/javascript/mastodon/features/compose/components/privacy_dropdown.js')
-rw-r--r--app/javascript/mastodon/features/compose/components/privacy_dropdown.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/javascript/mastodon/features/compose/components/privacy_dropdown.js b/app/javascript/mastodon/features/compose/components/privacy_dropdown.js
index 57588fe96..96028e042 100644
--- a/app/javascript/mastodon/features/compose/components/privacy_dropdown.js
+++ b/app/javascript/mastodon/features/compose/components/privacy_dropdown.js
@@ -100,7 +100,7 @@ class PrivacyDropdownMenu extends React.PureComponent {
   componentDidMount () {
     document.addEventListener('click', this.handleDocumentClick, false);
     document.addEventListener('touchend', this.handleDocumentClick, listenerOptions);
-    if (this.focusedItem) this.focusedItem.focus();
+    if (this.focusedItem) this.focusedItem.focus({ preventScroll: true });
     this.setState({ mounted: true });
   }