headlessui
headlessui copied to clipboard
Add open and close events to popover
As a user of this library i want to run some side effects when the popover is opened or closed, without these events, its very hacky and easy to miss some accessible ways of opening the popover.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| headlessui-react | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Feb 19, 2024 11:26am |
| headlessui-vue | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Feb 19, 2024 11:26am |
Hey!
Thank you for the contribution. The big difference in API between a Dialog and a Popover is that a Dialog is fully controlled and a Popover is not controlled at all. This means that the Dialog requires an onClose in React or a close event in Vue otherwise there is no way to close the Dialog at all.
This also means that only components that you control have events or callback so that you can (and should) act upon the events.
For v2 of Headless UI we want to expose events for exposing information when internal state changes, ideally with information about why a change happened. This however is a bigger project because it applies to all the components and we have to decide on the API/naming we want to use for exposing this information.
For that reason, I'm going to close this PR for now and we will work on the API. I also wrote down your username so that we can include you as a co-author once we open some PRs for adding this information in a way that applies to all the components.
Thanks again for contributing!