Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Akiyamka committed Jan 19, 2024
1 parent 4aeb67f commit 9a1ec80
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/ui-kit/src/Modal/useKeyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ export function useKeyboard(
const onKeyPress = (event: KeyboardEvent) => {
if (event.key === key) cb();
};
document.addEventListener(event, onKeyPress);
return () => document.removeEventListener(event, onKeyPress);
document?.addEventListener(event, onKeyPress);
return () => document?.removeEventListener(event, onKeyPress);
}
return;
}, [cb, key, event]);
}

0 comments on commit 9a1ec80

Please sign in to comment.