mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-26 20:36:25 +00:00
[Glitch] fix: Prevent scrolling behind menus and modals in Safari iOS
Port c1ef1f62d5 to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -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;
|
||||
};
|
||||
Reference in New Issue
Block a user