-
-
Notifications
You must be signed in to change notification settings - Fork 344
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
Sheet with anchor links not working properly on mobile #1159
Comments
This comment was marked as spam.
This comment was marked as spam.
Is there someone with the same issue or does someone have a easy solution? |
This comment was marked as spam.
This comment was marked as spam.
Bumping isn't going to get the issue addressed any faster. |
This is also happening to me with a
despite trying I haven't been able to find a workaround/ still happens if the
|
I have a pretty nasty workaround but for my case it is working fine for what it is supposed to be. You need to put your links with the link of each item in the main layout so outside your sheet component. Then I will put a button in the sheet for each sheet item like this:
Then this will call a function which will close the sheet and then go to the link with a delay which seems to fix the issue for me but at large scale this wouldn't be sufficient:
It is still not perfect but for my use case that doesn't really matter for now but i hope this gets a official fix |
Additional Comments and FindingsI encountered a similar issue when using the Sheet component from shadcn-svelte with anchor-based navigation ( Temporary SolutionAs suggested by @VerburgtJimmy, wrapping the setTimeout(() => {
targetElement.scrollIntoView({
behavior: 'smooth',
block: 'start',
});
}, 400); Context and EnvironmentFramework: Astro Thank you ❤️ @VerburgtJimmy |
Describe the bug
I want to close the sheet when clicking on a link in my menu that has a anchor. So the sheet needs to close and then the page scroll to the clicked anchor.
I have the same bug as in the react shadcn see this issue: shadcn-ui/ui#844
The provided answer on that issue doesn't work for this svelte version.
Does someone have the same issue.
ps. My code does work on a pc how i expect it to work but just not on a ios Iphone like the issue with the react version.
Reproduction
https://stackblitz.com/edit/github-hworis?file=src%2Froutes%2F%2Bpage.svelte
This reproduction doesn't work. the stackblitz doesn't do anchors for some reason but you can get the idea i am going for.
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: