Skip to content

Commit

Permalink
patch: replace e.key with e.code
Browse files Browse the repository at this point in the history
  • Loading branch information
vinaybadgujar102 committed Oct 13, 2024
1 parent 2bb7910 commit 1ab50be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hooks/useKeyPress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const useKeyPress = (targetKey: string) => {
const keyHandler = useCallback(
(event: KeyboardEvent) => {
event.stopPropagation();
if (event.key === targetKey || (targetKey === "Space" && event.key === " ")) {
if (event.code === targetKey) {
setKeyPressed(event.type === "keydown");
}
},
Expand Down

0 comments on commit 1ab50be

Please sign in to comment.