diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-07-31 01:14:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-31 01:14:33 +0200 |
commit | 60df87f6f0fb8afd9a4e750917eff7c425b62891 (patch) | |
tree | 24e5b226db223f2e774c1dfa16f138e24d46eda7 /app/javascript/mastodon/features/ui/components/modal_root.js | |
parent | e7e577dd6e82d9b6ae3afa799a56953d0468deea (diff) |
Compensate for scrollbar disappearing when media modal visible (#8100)
* Compensate for scrollbar disappearing when media modal visible Make auth pages backgrounds lighter * Fix typo
Diffstat (limited to 'app/javascript/mastodon/features/ui/components/modal_root.js')
-rw-r--r-- | app/javascript/mastodon/features/ui/components/modal_root.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/app/javascript/mastodon/features/ui/components/modal_root.js b/app/javascript/mastodon/features/ui/components/modal_root.js index a334318ce..d8e034554 100644 --- a/app/javascript/mastodon/features/ui/components/modal_root.js +++ b/app/javascript/mastodon/features/ui/components/modal_root.js @@ -41,14 +41,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 => () => { |