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

This commit is contained in:
diondiondion authored and GitHub committed 2025-06-25 12:12:49 +00:00
1 parent c52848b444
commit c6dddbb66e
7 files changed
+83 -41

No files matched your search

+4 -16
View File
@@ -1,8 +1,9 @@
import { isMobile } from '../is_mobile';
let cachedScrollbarWidth: number | null = null;
const getActualScrollbarWidth = () => {
export const getScrollbarWidth = () => {
if (isMobile(window.innerWidth)) {
return 0;
}
const outer = document.createElement('div');
outer.style.visibility = 'hidden';
outer.style.overflow = 'scroll';
@@ -16,16 +17,3 @@ const getActualScrollbarWidth = () => {
return scrollbarWidth;
};
export const getScrollbarWidth = () => {
if (cachedScrollbarWidth !== null) {
return cachedScrollbarWidth;
}
const scrollbarWidth = isMobile(window.innerWidth)
? 0
: getActualScrollbarWidth();
cachedScrollbarWidth = scrollbarWidth;
return scrollbarWidth;
};