emilkowalski / vaul

An unstyled drawer component for React.
https://vaul.emilkowal.ski
MIT License
5.98k stars 199 forks source link

Anchor tag hyperlink to page fragments not working #352

Closed AuJezus closed 1 week ago

AuJezus commented 4 months ago

When using with href='#id', the url gets set correctly, but it doesn't scroll to the element with #id. If you close the drawer and press the same link outside the drawer it works.

I think it might be an issue with some kind of overlay and the browser can't find ids. Is there any workaround for this?

matiasmarcodelpont commented 4 months ago

Having the same issue

moonhee0507 commented 2 months ago

I had the same problem as you and it was solved through this:

https://github.com/shadcn-ui/ui/issues/3536#issuecomment-2138995083

As stated in the original solution, it seems to be a trick method rather than a fundamental solution.

hashchange event -> Save hash state -> Scroll after 500ms

Maybe it will help you.

emilkowalski commented 1 week ago

This should be fixed in #406