You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See the new drawer close itself because of onOpenChange
Expected behavior
I expected the new drawer from not closing itself automatically.
Additional context
It's actually worse with an DropdownMenu item, because it'll close itself but after this I won't be able to interact anymore with the app because the drawer seems like to be still there.
hm this is tricky to solve, it's actually two issues that come to play here:
In your stackblitz repro the problem is that the first drawer moves the focus to the trigger after the closing transition finishes, which causes the other drawer to close too because the focus moves outside of it. You could prevent that by doing onOutsideFocus={e => e.preventDefault()} on the first drawer to prevent focusing outside if you're opening a new drawer anyways.
With the dropdown, it's probably the same issue and that the drawer opens with a pointerdown event and closes instantly again with the pointerup event. You could either solve this with using <Drawer.Trigger> as the element in the dropdown (In kobalte you can use the as prop) or you can set closeOnOutsidePointerStrategy="pointerdown" so that it doesn't close instantly. You probably also have to set onCloseAutoFocus={e => e.preventDefault() on the Kobalte DropdownMenu.Content to solve the first issue here.
I have to think about what first party solution could be satisfying here, sadly it's not a quick fix so I can't promise anything soon.
Bug description
In my app, I have a DropdownMenu from Kobalte and when clicking an item from this menu, it opens a Drawer from corvu using
open
andonOpenChange
.When I do this, it'll automatically close the Drawer. If I log the output of
onOpenChange
, it shows mefalse
two times.It does NOT only happens with elements from Kobalte, if I want to open another Drawer from a Drawer, it also does it.
Reproduction Link
https://stackblitz.com/edit/vexcited-corvu-drawer-issue-repro?file=src%2FApp.jsx
Reproduction Steps
onOpenChange
Expected behavior
I expected the new drawer from not closing itself automatically.
Additional context
It's actually worse with an DropdownMenu item, because it'll close itself but after this I won't be able to interact anymore with the app because the drawer seems like to be still there.
2025-03-07.14-47-05.mp4
The code for this looks like this...
2025-03-07.14-51-02.mp4
The text was updated successfully, but these errors were encountered: