summaryrefslogtreecommitdiff
path: root/apps/web/src/hooks
diff options
context:
space:
mode:
authorKha Nguyen <hi@khanguyen.com>2025-07-22 18:52:49 -0500
committerKha Nguyen <hi@khanguyen.com>2025-07-22 18:54:32 -0500
commit901ddb509db23695cf9d71bf733e6a7185317960 (patch)
tree5504e70278c5b2f4371cb6ddb3eccbed3ab1b054 /apps/web/src/hooks
parentcabf86033032f0a396569cce9165cd656be791d6 (diff)
downloadopencut-901ddb509db23695cf9d71bf733e6a7185317960.tar.gz
fix: prevent action to perform on key press when edit keybindings
Diffstat (limited to 'apps/web/src/hooks')
-rw-r--r--apps/web/src/hooks/use-keybindings.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/web/src/hooks/use-keybindings.ts b/apps/web/src/hooks/use-keybindings.ts
index 7887f3f1..0e2045ac 100644
--- a/apps/web/src/hooks/use-keybindings.ts
+++ b/apps/web/src/hooks/use-keybindings.ts
@@ -8,13 +8,15 @@ import { useKeybindingsStore } from "@/stores/keybindings-store";
* the appropriate actions based on keybindings
*/
export function useKeybindingsListener() {
- const { keybindings, getKeybindingString, keybindingsEnabled } =
+ const { keybindings, getKeybindingString, keybindingsEnabled, isRecording } =
useKeybindingsStore();
useEffect(() => {
const handleKeyDown = (ev: KeyboardEvent) => {
// Do not check keybinds if the mode is disabled
if (!keybindingsEnabled) return;
+ // ignore key events if user is changing keybindings
+ if (isRecording) return;
const binding = getKeybindingString(ev);
if (!binding) return;
@@ -45,7 +47,7 @@ export function useKeybindingsListener() {
return () => {
document.removeEventListener("keydown", handleKeyDown);
};
- }, [keybindings, getKeybindingString, keybindingsEnabled]);
+ }, [keybindings, getKeybindingString, keybindingsEnabled, isRecording]);
}
/**