From 5751f133858ab7b005900e43f7ddabbe4df62f37 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 21 Feb 2025 23:42:13 +0700 Subject: [PATCH] ignore keyboard events with modifier --- frontend/src/functions/useKeypressHook.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/functions/useKeypressHook.tsx b/frontend/src/functions/useKeypressHook.tsx index 55287795..9037e8b7 100644 --- a/frontend/src/functions/useKeypressHook.tsx +++ b/frontend/src/functions/useKeypressHook.tsx @@ -6,7 +6,13 @@ export function useKeyPress(targetKey: string) { useEffect(() => { const handleKeyDown = (event: KeyboardEvent) => { - if (event.key === targetKey) { + if ( + event.key === targetKey && + !event.ctrlKey && + !event.metaKey && + !event.altKey && + !event.altKey + ) { setIsKeyPressed(true); } };