Skip to content

Commit

Permalink
fix useDisableBodyScroll #37
Browse files Browse the repository at this point in the history
  • Loading branch information
ukorvl committed Aug 3, 2023
1 parent 3950dd6 commit 75443e4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/shared/useDisableBodyScroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ export default function useDisableBodyScroll(open: boolean) {
document.body.style.overflow = 'hidden';

if (getBosyHasOevrflow()) {
document.documentElement.style.scrollbarGutter = 'stable';
const scrollbarWidth = window.innerWidth - document.body.clientWidth;
document.body.style.paddingRight = `${scrollbarWidth}px`;
}
} else {
document.body.style.overflow = 'unset';
document.documentElement.style.scrollbarGutter = 'auto';
document.body.style.paddingRight = 'unset';
}
}, [open]);
}
Expand Down

0 comments on commit 75443e4

Please sign in to comment.