Skip to content

Commit

Permalink
format (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilkowalski committed Oct 18, 2023
1 parent 40d6ebc commit 35310de
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/use-position-fixed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function usePositionFixed({

function setPositionFixed() {
// If previousBodyPosition is already set, don't set it again.
if (previousBodyPosition === null) {
if (previousBodyPosition === null && isOpen) {
previousBodyPosition = {
position: document.body.style.position,
top: document.body.style.top,
Expand Down Expand Up @@ -98,7 +98,7 @@ export function usePositionFixed({
} else {
restorePositionSetting();
}
}, [isOpen]);
}, [isOpen, hasBeenOpened]);

return { restorePositionSetting };
}

0 comments on commit 35310de

Please sign in to comment.