Skip to content

Commit

Permalink
Use capture phase
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitgrelard committed Mar 6, 2024
1 parent 2790136 commit 558fcf1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/react/use-escape-keydown/src/useEscapeKeydown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ function useEscapeKeydown(
onEscapeKeyDown(event);
}
};
ownerDocument.addEventListener('keydown', handleKeyDown);
return () => ownerDocument.removeEventListener('keydown', handleKeyDown);
ownerDocument.addEventListener('keydown', handleKeyDown, { capture: true });
return () => ownerDocument.removeEventListener('keydown', handleKeyDown, { capture: true });
}, [onEscapeKeyDown, ownerDocument]);
}

Expand Down

0 comments on commit 558fcf1

Please sign in to comment.