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
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).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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