Skip to content

Commit 2196f7c

Browse files
committed
changing document and keyup listeners to window and keydown respectively to ensure that firefox's native find tool is not used when the / key is pressed
1 parent 9ebf95b commit 2196f7c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/components/SearchInput.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ const SearchInput = () => {
7373
);
7474

7575
useEffect(() => {
76-
document.addEventListener("keyup", handleSearchKeyPress);
77-
document.addEventListener("keyup", handleEscapeKeyPress);
76+
window.addEventListener("keydown", handleSearchKeyPress);
77+
window.addEventListener("keyup", handleEscapeKeyPress);
7878

7979
return () => {
80-
document.removeEventListener("keyup", handleSearchKeyPress);
81-
document.removeEventListener("keyup", handleEscapeKeyPress);
80+
window.removeEventListener("keydown", handleSearchKeyPress);
81+
window.removeEventListener("keyup", handleEscapeKeyPress);
8282
};
8383
}, [handleEscapeKeyPress]);
8484

0 commit comments

Comments
 (0)