Extend use-click-outside to pass the triggering event to the callback #8281
ThoDon
started this conversation in
Feature requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, the use-click-outside hook accepts a callback that is executed when a click outside the referenced element occurs. However, the callback does not receive the triggering event object, which can limit flexibility in certain use cases (e.g., distinguishing between left/right clicks, preventing default behavior, or accessing event target details).
Proposal
Extend the use-click-outside hook so that the callback receives the native event as a parameter. For example:
useClickOutside((event) => { console.log("Clicked outside:", event.target); });This would allow developers to access event details and implement more granular behavior without needing to add separate global event listeners.
Beta Was this translation helpful? Give feedback.
All reactions