shadcn-ui / ui

Beautifully designed components that you can copy and paste into your apps. Accessible. Customizable. Open Source.
https://ui.shadcn.com
MIT License
73.72k stars 4.54k forks source link

[bug]: Multiple DropdownMenu in sidebar causes freeze on mobile screen #5642

Open PanThomas opened 5 days ago

PanThomas commented 5 days ago

Describe the bug

https://ui.shadcn.com/blocks#sidebar-07

If you open multiple dropdown menus on a phone screen and close the sidebar, the whole app freezes.

Affected component/components

Sidebar

How to reproduce

  1. Visit https://ui.shadcn.com/blocks#sidebar-07
  2. Click on the phone screen.
  3. Open the sidebar.
  4. Open the dropdown menu in the company switcher (Acme).
  5. Open the profile dropdown menu (shadcn at the bottom).
  6. Click away to close the sidebar.
  7. Now, you can't do anything; you can't even reopen the sidebar.

Codesandbox/StackBlitz link

https://ui.shadcn.com/blocks#sidebar-07

Logs

No response

System Info

google chrome, windows 11

Before submitting

joeydewaal commented 4 days ago

+1, I have the same problem

PanThomas commented 4 days ago

+1, I have the same problem

i fixed it like this:

const { isMobile, openMobile } = useSidebar()
if (!openMobile) {
    return null
  }

return ...

so far it works