Skip to content

Commit

Permalink
Fix fixed position when unmounting (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilkowalski committed Oct 18, 2023
1 parent 46513ad commit 40d6ebc
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,10 @@ function Root({
}

React.useEffect(() => {
// Clean up the wrapper styles in case the drawer has been unmounted without closing it
const wrapper = document.querySelector('[vaul-drawer-wrapper]');

if (wrapper) {
return () => {
scaleBackground(false);
restorePositionSetting();
};
}
return () => {
scaleBackground(false);
restorePositionSetting();
};
}, []);

React.useEffect(() => {
Expand Down

0 comments on commit 40d6ebc

Please sign in to comment.