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 446042d commit 58df1ef
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 58df1ef

Please sign in to comment.