about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/ui/components/modal_root.js
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-07-31 23:04:09 +0200
committerThibaut Girka <thib@sitedethib.com>2018-08-01 00:18:42 +0200
commit175c2155a9c674fc225cc943a3fb6fdfc26571f7 (patch)
tree25bb51989c1ec808b3ea7958c963ff2d03860d06 /app/javascript/flavours/glitch/features/ui/components/modal_root.js
parentd2b3eebe00ea60df56704045a8459acb03867555 (diff)
[Glitch] Compensate for scrollbar disappearing when media modal
Port 60df87f6f0fb8afd9a4e750917eff7c425b62891 to glitch-soc
Diffstat (limited to 'app/javascript/flavours/glitch/features/ui/components/modal_root.js')
-rw-r--r--app/javascript/flavours/glitch/features/ui/components/modal_root.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/app/javascript/flavours/glitch/features/ui/components/modal_root.js b/app/javascript/flavours/glitch/features/ui/components/modal_root.js
index 86e1f8695..e54ab9a52 100644
--- a/app/javascript/flavours/glitch/features/ui/components/modal_root.js
+++ b/app/javascript/flavours/glitch/features/ui/components/modal_root.js
@@ -45,14 +45,15 @@ export default class ModalRoot extends React.PureComponent {
   };
 
   getSnapshotBeforeUpdate () {
-    const visible = !!this.props.type;
-    return {
-      overflowY: visible ? 'hidden' : null,
-    };
+    return { visible: !!this.props.type };
   }
 
-  componentDidUpdate (prevProps, prevState, { overflowY }) {
-    document.body.style.overflowY = overflowY;
+  componentDidUpdate (prevProps, prevState, { visible }) {
+    if (visible) {
+      document.body.classList.add('with-modals--active');
+    } else {
+      document.body.classList.remove('with-modals--active');
+    }
   }
 
   renderLoading = modalId => () => {