primitives
primitives copied to clipboard
Radix Dialog - Events for open and close separately
Can we have separate events to trigger for onOpen and onClose in a modal?
Currently we've the onOpenChange for radix dialog that triggers whenever the dialog opens or closes. Can we bring a way to have individual events for open and close?
I've a logic for it already, if its required, I can raise a PR
Hi @varun-raj,
What would be the advantage of this? The current API achieves everything without bloating the API surface.
Closing this issue due to lack of activity, feel free to follow up with more information about the request though.
@andy-hook it seems like the onOpenChange prop is inactive for open event. i am using this version "@radix-ui/react-dialog": "^1.0.2", any thoughts?
@TimHuynh0905 what do you mean? Do you have an example sandbox?
@benoitgrelard I'm facing the same issue, onOpenChange does not seem to be triggered when open property is switching from false to true.
Here is our usage of the dialog: https://github.com/twentyhq/twenty/blob/b982788100a95a9494e0ec961062e6faa7cf3aa2/front/src/modules/command-menu/components/CommandMenu.tsx#L18
@charlesBochet onOpenChange is only triggered when the state is updated internally by Radix
mmmh ok, thanks for the answer!