Replies: 1 comment
-
Same problem here. I made this sandbox to check it and dialog calls I can see why this is done this way, but it creates problems too. Just for context: I came here because this behavior breaks Vaul's nested drawers animation for controlled drawers where is depends on onOpenChange being called. Here is my issue about it. |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm facing an issue with the onOpenChange callback in the Dialog component from Radix UI. I’m managing the open state manually (without using the Trigger component), and the onOpenChange callback only fires when the dialog closes (false). It doesn't fire when the dialog opens (true).
Here's the code I’m working with:
<Dialog.Root open={isOpen} onOpenChange={handleOpenChange}> <Dialog.Portal> <Dialog.Overlay /> <Dialog.Content> <Dialog.Title>My Dialog</Dialog.Title> <Dialog.Close>Close</Dialog.Close> </Dialog.Content> </Dialog.Portal> <button onClick={() => setIsOpen(true)}>Open Dialog</button> </Dialog.Root>
Beta Was this translation helpful? Give feedback.
All reactions