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
In some cases, the hook will call onTriggered unexpectedly if the clicked element removes itself from the DOM via an onClick handler. It seems like by the time useDetectClickOutside's click handler is called, React has already run the target element's onClick, updating and removing the target element from the DOM so it no longer counts as being "inside" the parent.
In some cases, the hook will call
onTriggered
unexpectedly if the clicked element removes itself from the DOM via anonClick
handler. It seems like by the timeuseDetectClickOutside
's click handler is called, React has already run the target element'sonClick
, updating and removing the target element from the DOM so it no longer counts as being "inside" the parent.Here's an example demonstrating the problem:
https://codesandbox.io/s/goofy-shannon-32xh9?file=/src/App.js
The text was updated successfully, but these errors were encountered: