huntabyte / shadcn-svelte

shadcn/ui, but for Svelte. ✨
https://shadcn-svelte.com
MIT License
4.39k stars 276 forks source link

Sheet with anchor links not working properly on mobile #1159

Open VerburgtJimmy opened 1 week ago

VerburgtJimmy commented 1 week ago

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: https://github.com/shadcn-ui/ui/issues/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

System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M1 Pro
    Memory: 787.34 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.2.0 - /opt/homebrew/bin/node
    npm: 10.7.0 - /opt/homebrew/bin/npm
    pnpm: 9.2.0 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 126.0.6478.114
    Edge: 126.0.2592.68
    Safari: 17.5
  npmPackages:
    @sveltejs/kit: ^2.0.0 => 2.5.10 
    bits-ui: ^0.21.10 => 0.21.10 
    cmdk-sv: ^0.0.17 => 0.0.17 
    lucide-svelte: ^0.381.0 => 0.381.0 
    mode-watcher: ^0.3.1 => 0.3.1 
    svelte: ^4.2.7 => 4.2.17 
    svelte-sonner: ^0.3.24 => 0.3.24

Severity

annoyance

VerburgtJimmy commented 1 week ago

Bump because this is still a problem

VerburgtJimmy commented 4 days ago

Is there someone with the same issue or does someone have a easy solution?