There are cases when an element inside a modal is no longer there byt the time useClickOutside decides whether to execute the callback, making the check always true and so, executing the callback when it shouldn't.
Solution
Add an extra check: make sure the element clicked is visible to then execute the callback.
Problem
There are cases when an element inside a modal is no longer there byt the time
useClickOutside
decides whether to execute the callback, making the check always true and so, executing the callback when it shouldn't.Solution
Add an extra check: make sure the element clicked is visible to then execute the callback.
Added a test case in the story: https://1713afae.hsds-react.pages.dev/?path=/story/components-overlay-simplemodal--with-trigger-and-nested