Do not add margin light when opening modal on mobile (#11830)
This commit is contained in:
parent
163ed91af3
commit
0a49b26793
3 changed files with 46 additions and 31 deletions
|
@ -1,6 +1,7 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import Base from '../../../components/modal_root';
|
||||
import { getScrollbarWidth } from 'mastodon/utils/scrollbar';
|
||||
import Base from 'mastodon/components/modal_root';
|
||||
import BundleContainer from '../containers/bundle_container';
|
||||
import BundleModalError from './bundle_modal_error';
|
||||
import ModalLoading from './modal_loading';
|
||||
|
@ -32,28 +33,6 @@ const MODAL_COMPONENTS = {
|
|||
'LIST_ADDER':ListAdder,
|
||||
};
|
||||
|
||||
let cachedScrollbarWidth = null;
|
||||
|
||||
export const getScrollbarWidth = () => {
|
||||
if (cachedScrollbarWidth !== null) {
|
||||
return cachedScrollbarWidth;
|
||||
}
|
||||
|
||||
const outer = document.createElement('div');
|
||||
outer.style.visibility = 'hidden';
|
||||
outer.style.overflow = 'scroll';
|
||||
document.body.appendChild(outer);
|
||||
|
||||
const inner = document.createElement('div');
|
||||
outer.appendChild(inner);
|
||||
|
||||
const scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
|
||||
cachedScrollbarWidth = scrollbarWidth;
|
||||
outer.parentNode.removeChild(outer);
|
||||
|
||||
return scrollbarWidth;
|
||||
};
|
||||
|
||||
export default class ModalRoot extends React.PureComponent {
|
||||
|
||||
static propTypes = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue