Skip to content

Commit

Permalink
fix(useClickOutside): reset waitingForTrigger if clicking outside tar…
Browse files Browse the repository at this point in the history
…get (#112)
  • Loading branch information
kyletsang authored Nov 19, 2024
1 parent d573045 commit 730a174
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/useClickOutside.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ function useClickOutside(

if (currentTarget && contains(currentTarget, e.target as any)) {
waitingForTrigger.current = true;
} else {
// When clicking on scrollbars within current target, click events are not triggered, so this ref
// is never reset inside `handleMouseCapture`. This would cause a bug where it requires 2 clicks
// to close the overlay.
waitingForTrigger.current = false;
}
});

Expand Down

0 comments on commit 730a174

Please sign in to comment.