Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Radix Dialog - Events for open and close separately #1678

Closed
varun-raj opened this issue Sep 21, 2022 · 7 comments
Closed

Radix Dialog - Events for open and close separately #1678

varun-raj opened this issue Sep 21, 2022 · 7 comments

Comments

@varun-raj
Copy link

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

@benoitgrelard
Copy link
Collaborator

Hi @varun-raj,

What would be the advantage of this? The current API achieves everything without bloating the API surface.

@andy-hook
Copy link
Collaborator

Closing this issue due to lack of activity, feel free to follow up with more information about the request though.

@TimHuynh0905
Copy link

@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?

@benoitgrelard
Copy link
Collaborator

@TimHuynh0905 what do you mean? Do you have an example sandbox?

@charlesBochet
Copy link

@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

@joaom00
Copy link
Contributor

joaom00 commented Jul 15, 2023

@charlesBochet onOpenChange is only triggered when the state is updated internally by Radix

@charlesBochet
Copy link

mmmh ok, thanks for the answer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants