huntabyte / bits-ui

The headless components for Svelte.
https://bits-ui.com
MIT License
953 stars 70 forks source link

Multiple context menu and closeOnOutsideClick not working correctly #563

Open rogerfar opened 1 month ago

rogerfar commented 1 month ago

Describe the bug

When having multiple ContextMenu's and you right click to open another one, the original one stays open, even with closeOnOutsideClick set.

The 2nd issue is that, when click outside (left click), it only closes the last opened context menu, so you have to click multiple times to close them all.

Reproduction

https://stackblitz.com/edit/github-tbmdqu?file=src%2Froutes%2F%2Bpage.svelte

Logs

No response

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (24) x64 13th Gen Intel(R) Core(TM) i7-13700       
    Memory: 33.16 GB / 63.79 GB
  Binaries:
    Node: 20.13.1 - C:\Program Files\nodejs\node.EXE        
    Yarn: 1.22.19 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 10.8.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (125.0.2535.67)
    Internet Explorer: 11.0.19041.4355
  npmPackages:
    @sveltejs/kit: ^2.5.10 => 2.5.10
    bits-ui: ^0.21.10 => 0.21.10
    svelte: ^4.2.17 => 4.2.17

Severity

annoyance