about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/components/modal_root.js
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-02-25 00:51:01 +0100
committerClaire <claire.github-309c@sitedethib.com>2022-02-26 09:54:48 +0100
commit8e04ba87b709365facbbe28682b2809225f209bc (patch)
treeef813144eaa86e7ee5b8527ea7fd74ac22817668 /app/javascript/flavours/glitch/components/modal_root.js
parent2e2b8a9a40ecdd2a7a63ecccb252af46179bbdb5 (diff)
[Glitch] Fix reply button on media modal not giving focus to compose form
Port 2cd31b31778cec3b282a44f03a03844d92a4e8cc to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/components/modal_root.js')
-rw-r--r--app/javascript/flavours/glitch/components/modal_root.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/components/modal_root.js b/app/javascript/flavours/glitch/components/modal_root.js
index 7b5a630e5..0595f6a0e 100644
--- a/app/javascript/flavours/glitch/components/modal_root.js
+++ b/app/javascript/flavours/glitch/components/modal_root.js
@@ -18,6 +18,7 @@ export default class ModalRoot extends React.PureComponent {
       b: PropTypes.number,
     }),
     noEsc: PropTypes.bool,
+    ignoreFocus: PropTypes.bool,
   };
 
   activeElement = this.props.children ? document.activeElement : null;
@@ -72,7 +73,9 @@ export default class ModalRoot extends React.PureComponent {
       // immediately selectable, we have to wait for observers to run, as
       // described in https://github.com/WICG/inert#performance-and-gotchas
       Promise.resolve().then(() => {
-        this.activeElement.focus({ preventScroll: true });
+        if (!this.props.ignoreFocus) {
+          this.activeElement.focus({ preventScroll: true });
+        }
         this.activeElement = null;
       }).catch(console.error);