diff options
| author | Kha Nguyen <hi@khanguyen.com> | 2025-07-22 18:52:49 -0500 |
|---|---|---|
| committer | Kha Nguyen <hi@khanguyen.com> | 2025-07-22 18:54:32 -0500 |
| commit | 901ddb509db23695cf9d71bf733e6a7185317960 (patch) | |
| tree | 5504e70278c5b2f4371cb6ddb3eccbed3ab1b054 /apps/web/src/hooks | |
| parent | cabf86033032f0a396569cce9165cd656be791d6 (diff) | |
| download | opencut-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.ts | 6 |
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]); } /** |
