-
-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transform not resetting when closing drawer #102
Comments
Can you provide a codesandbox? It's working fine on vaul.emilkowal.ski |
Sure thing. Here you go: You'll notice the scaling doesn't reset, nor does the background color |
What's diferent than in the example here? https://codesandbox.io/p/sandbox/drawer-with-scale-g24vvh?file=%2Fapp%2Fmy-drawer.tsx%3A1%2C1 This also runs on the latest version and doesn't have this problem. What did you change from the default example? I don't notice anything that might be causing it. |
I updated my sandbox to match your example verbatim. The only differences are the versions listed in the package.json. I downgraded to 13.4.10 and it started working. So there’s something causing the issue between this and the latest 13.5.1. |
That's interesting, thank you for catching that. I'll look into it. |
Sure thing. For the time being, I added the following to the Drawer.Root to restore the initial styling: onClose={ () => {
setTimeout(() => {
const wrapper = document.querySelector('[vaul-drawer-wrapper]') as HTMLDivElement;
wrapper.style.transform = '';
document.body.style.background = '';
}, 0);
} } |
Noticed a similar issue with body styles not being cleared after triggering a route change inside the drawer. My hypothesis is that the I added a 500ms delay between the drawer closing and route change, the behaviour did not occur then. Inspired by @Kinbaum (thanks 🙌) added this:
Which fixes the issue for now. EDIT: this is on Next 13.4.12 and vaul 6.0.3 |
@emilkowalski should this be a separate issue? |
@raimondlume I think this is the same issue? #61 |
Also the onClose={() => {
setTimeout(() => {
const wrapper = document.querySelector('[vaul-drawer-wrapper]')
if (wrapper) {
wrapper.style.transform = ''
wrapper.style.borderRadius = ''
document.body.style.background = ''
}
}, 0)
}} |
Fixed in #111 |
On the latest version of vaul (0.6.3) the
[vaul-drawer-wrapper]
is not resetting the transform upon close.Screen.Recording.2023-09-19.at.1.46.53.PM.mov
The text was updated successfully, but these errors were encountered: