You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an Overlay which is opened by clicking an icon button. In that Overlay, I'm using the useClickAway hook exported by the react-use library -
useClickAway(overlayRef, hideOverlay);
Basically, whenever a user clicks anywhere outside the overlay dom node, it hides this overlay.
But with this, I'm facing one issue when a user clicks on that button (which opens this overlay), this overlay first closes and then re-opens, which causes the flickering of the overlay.
How can I make clicking on this button an exception for this useClickAway hook?
I have tried adding event.stopPropagation to click the event handler on the button but it didn't work.
What is the current behavior?
I have an Overlay which is opened by clicking an icon button. In that Overlay, I'm using the
useClickAway
hook exported by thereact-use
library -Basically, whenever a user clicks anywhere outside the overlay dom node, it hides this overlay.
But with this, I'm facing one issue when a user clicks on that
button
(which opens this overlay), this overlay first closes and then re-opens, which causes the flickering of the overlay.How can I make clicking on this
button
an exception for thisuseClickAway
hook?I have tried adding
event.stopPropagation
to click the event handler on thebutton
but it didn't work.Codesandbox Link for same - https://codesandbox.io/s/useclickaway-hook-krd6y6
What is the expected behavior?
It should not close the overlay on clicking button
A little about versions:
react-use
: 17.4.0The text was updated successfully, but these errors were encountered: