Skip to content

Commit

Permalink
fix: prevent restorePositionSetting 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 8666056
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 @@ -133,7 +133,7 @@ const setPositionFixed = () => window.requestAnimationFrame(() => {
}
});

const restorePositionSetting = () => {
const restorePositionSetting = () => window.requestAnimationFrame(() => {
if (previousBodyPosition !== undefined) {
// Convert the position from "px" to Int
const y = -parseInt(document.body.style.top, 10);
Expand All @@ -149,7 +149,7 @@ const restorePositionSetting = () => {

previousBodyPosition = undefined;
}
};
});

// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight#Problems_and_solutions
const isTargetElementTotallyScrolled = (targetElement: any): boolean =>
Expand Down

0 comments on commit 8666056

Please sign in to comment.