Skip to content

Commit

Permalink
fix: prevent restoreOverflowSetting to run before setPositionFixed
Browse files Browse the repository at this point in the history
  • Loading branch information
dafcoe authored and dfvc-txb committed Feb 8, 2022
1 parent 79c4cf2 commit b75ae76
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/bodyScrollLock.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const setOverflowHidden = (options?: BodyScrollOptions) => {
}
};

const restoreOverflowSetting = () => {
const restoreOverflowSetting = () => window.requestAnimationFrame(() => {
if (previousBodyPaddingRight !== undefined) {
document.body.style.paddingRight = previousBodyPaddingRight;

Expand All @@ -105,7 +105,7 @@ const restoreOverflowSetting = () => {
// so setOverflowHidden knows it can be set again.
previousBodyOverflowSetting = undefined;
}
};
});

const setPositionFixed = () => window.requestAnimationFrame(() => {
// If previousBodyPosition is already set, don't set it again.
Expand Down

0 comments on commit b75ae76

Please sign in to comment.