radix-ui / primitives

Radix Primitives is an open-source UI component library for building high-quality, accessible design systems and web apps. Maintained by @workos.
https://radix-ui.com/primitives
MIT License
15.85k stars 821 forks source link

hope dialog add complete close event #3128

Open xiefenga opened 1 month ago

xiefenga commented 1 month ago

Feature request

Overview

Is it possible to add a fully closed event to the dialog component?

Examples in other libraries

such as afterClose in antd, onCloseComplete in chakra-ui

Who does this impact? Who is this for?

I hope to make @radix-ui/react-dialog work well with nice-modal-react

Some people prefer to use programmatic methods to drive dialogs.

Additional context

chrishoermann commented 1 week ago

this should be the onCloseAutoFocus event handler on the Dialog.Content. This event handler is called when the focus moves back to the trigger after the close animation is complete. So I think this could fullfill your needs.