Skip to content

Commit

Permalink
fix(Notification): add NPE check in escape close handler
Browse files Browse the repository at this point in the history
  • Loading branch information
emyarod committed Sep 19, 2024
1 parent 6dd3d88 commit 73027d9
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function useEscapeToClose(ref, callback, override = true) {
// The callback should only be called when focus is on or within the container
const elementContainsFocus =
(ref.current && document.activeElement === ref.current) ||
ref.current.contains(document.activeElement);
ref.current?.contains(document.activeElement);

if (matches(event, [keys.Escape]) && override && elementContainsFocus) {
callback(event);
Expand Down

0 comments on commit 73027d9

Please sign in to comment.