fix: Prevent content scrolling behind main menu (part 1) (#35173)

This commit is contained in:
diondiondion 2025-06-25 14:12:49 +02:00 committed by GitHub
commit c6dddbb66e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 83 additions and 41 deletions

View file

@ -20,7 +20,6 @@ import {
IgnoreNotificationsModal,
AnnualReportModal,
} from 'mastodon/features/ui/util/async-components';
import { getScrollbarWidth } from 'mastodon/utils/scrollbar';
import BundleContainer from '../containers/bundle_container';
@ -90,20 +89,6 @@ export default class ModalRoot extends PureComponent {
backgroundColor: null,
};
getSnapshotBeforeUpdate () {
return { visible: !!this.props.type };
}
componentDidUpdate (prevProps, prevState, { visible }) {
if (visible) {
document.body.classList.add('with-modals--active');
document.documentElement.style.marginRight = `${getScrollbarWidth()}px`;
} else {
document.body.classList.remove('with-modals--active');
document.documentElement.style.marginRight = '0';
}
}
setBackgroundColor = color => {
this.setState({ backgroundColor: color });
};