fix: Prevent scrolling behind menus and modals in Safari iOS (#35183)
This commit is contained in:
parent
dbb20f76a7
commit
c1ef1f62d5
4 changed files with 24 additions and 88 deletions
|
|
@ -1,19 +0,0 @@
|
|||
import { isMobile } from '../is_mobile';
|
||||
|
||||
export const getScrollbarWidth = () => {
|
||||
if (isMobile(window.innerWidth)) {
|
||||
return 0;
|
||||
}
|
||||
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;
|
||||
outer.remove();
|
||||
|
||||
return scrollbarWidth;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue