We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bef40cb commit 62d7c44Copy full SHA for 62d7c44
frontend/src/components/Hamburger.tsx
@@ -26,13 +26,15 @@ const Hamburger = () => {
26
27
useEffect(() => {
28
if (showMenu) {
29
+ // Add padding when scrollbar vanishes
30
+ const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
31
document.body.style.overflow = 'hidden';
- } else {
- document.body.style.overflow = 'scroll';
32
+ document.body.style.paddingRight = `${scrollbarWidth}px`;
33
}
34
35
return () => {
36
document.body.style.overflow = 'scroll';
37
+ document.body.style.paddingRight = '0px';
38
};
39
}, [showMenu]);
40
0 commit comments