about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/compose/components/dropdown.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-08-21 14:14:28 +0200
committerThibaut Girka <thib@sitedethib.com>2020-08-30 16:31:02 +0200
commit45d1f34a3074782fb68d322cb90dc21b46744426 (patch)
tree2675e7d67071a5934f062d7532e66afe0e2d60bd /app/javascript/flavours/glitch/features/compose/components/dropdown.js
parent8c3c27bf063d648823da39a206be3efd285611ad (diff)
[Glitch] Fix scrolling issues when closing some dropdown menus
Port c7cfd4e67aedb38cba3ee452e18bd086e30e2e5d to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/features/compose/components/dropdown.js')
-rw-r--r--app/javascript/flavours/glitch/features/compose/components/dropdown.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/features/compose/components/dropdown.js b/app/javascript/flavours/glitch/features/compose/components/dropdown.js
index 60035b705..04ef3964b 100644
--- a/app/javascript/flavours/glitch/features/compose/components/dropdown.js
+++ b/app/javascript/flavours/glitch/features/compose/components/dropdown.js
@@ -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 });
   }