huntabyte / shadcn-svelte

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

Dropdown menu does not close on click if page contains element with transition #1292

Open Stadly opened 2 days ago

Stadly commented 2 days ago

Describe the bug

The the page contains an element with a transition, the dropdown menu does not close when clicking a dropdown item. The transition is run, and the page navigates, but the dropdown menu stays open on the new page.

This even happens if the transition has 0 duration, so I have found no way to work around it except removing all out-transitions.

As you can see in the video below, the issues does not happen every single time, but usually when navigating from About to Home, since About contains an SVG with an out transition. It never happens when navigating from Home to About, since Home does not contain a transitioning element.

https://github.com/user-attachments/assets/9c1cda98-80df-44f4-bcfb-c6986255aff5

Reproduction

https://www.sveltelab.dev/w49gnj29qhqvsby

Logs

No response

System Info

System:
    OS: Linux 5.15 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
    CPU: (16) x64 Intel(R) Xeon(R) W-11955M CPU @ 2.60GHz
    Memory: 4.90 GB / 15.23 GB
    Container: Yes
    Shell: 5.2.15 - /bin/bash
  Binaries:
    Node: 20.17.0 - /usr/local/bin/node
    Yarn: 1.22.22 - /usr/local/bin/yarn
    npm: 10.8.2 - /usr/local/bin/npm
  npmPackages:
    @sveltejs/kit: ^2.5.18 => 2.5.18 
    bits-ui: ^0.21.15 => 0.21.15 
    formsnap: ^1.0.1 => 1.0.1 
    svelte: ^4.2.19 => 4.2.19 
    svelte-sonner: ^0.3.28 => 0.3.28 
    sveltekit-superforms: ^2.16.1 => 2.16.1 
    vaul-svelte: ^0.3.2 => 0.3.2 


### Severity

annoyance
Stadly commented 1 day ago

Thinking about it, the issue probably lies with Bits UI or Melt UI, and not shadcn-svelte. What do you think, @huntabyte?