Description
🙋 Feature Request
Add the ability to differentiate between different interactions in order to perform specific tasks such as "apply" on an outside click and "remove all changes" on escape
key presses.
🤔 Expected Behavior
The event object (or some other way of interaction differentiation) should be passed through to onClose()
in order for the consumer to determine what happened that cause the onClose()
handler to run and how to handle it.
😯 Current Behavior
The useOverlay
hook handles the behavior for overlays when an interaction happens outside of said overlay but it does not allow consumers to know what type of interaction caused the overlay to close.
💁 Possible Solution
Possibly passing the events through into onHide()
which then passes it to onClose()
for consumer usage?
🔦 Context
I am using the different overlay hooks to create a popover dialog that happens to contain a date picker. The behavior I require for this component is:
- If the user clicks outside of the trigger element, apply the dates.
- If the user presses the "Escape" key, close the popover and do nothing with the dates.