Open GalvinGao opened 5 months ago
Think you included the wrong demo, this doesn't have Virtuoso
Thanks for the reply! The corresponding file is located at app/page.tsx
. Please refer to the screenshot below.
Edit: Sorry for the confusion, I've updated the link to the correct one.
Did you find any solutions to this?
Did you find any solutions to this?
Not yet. Tried forking vaul
and modify myself (specifically scroll restorations) but haven't successfully fixed it myself yet.
Reproduce Link
https://codesandbox.io/p/devbox/drawer-with-scale-forked-764l2f
How to Reproduce
Speculations
By inspecting in the Safari Inspector I can see that the drawer was indeed created but it was then unmounted almost instantly. I then went into the code base and found this. If after clicking the trigger the page is automatically scrolled to (0, 0) then
Virtuoso
will unmount the drawer trigger along with the drawer content altogether since it is now out of the viewport. This behavior is further confirmed by scroll down the page a tiny bit (to let drawer 1~2 trigger be the top-most visible drawer trigger) then click any drawer triggers. You may observe from the overlay/backdrop that the page itself is indeed scrolled to (0, 0).Potential Solutions
I don't know the consequences of removing
window.scrollTo(0, 0)
altogether, but it seems that removing it may solve the issue.