summaryrefslogtreecommitdiff
path: root/apps/web/src/components
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/components
parentcabf86033032f0a396569cce9165cd656be791d6 (diff)
downloadopencut-901ddb509db23695cf9d71bf733e6a7185317960.tar.gz
fix: prevent action to perform on key press when edit keybindings
Diffstat (limited to 'apps/web/src/components')
-rw-r--r--apps/web/src/components/keyboard-shortcuts-help.tsx10
1 files changed, 7 insertions, 3 deletions
diff --git a/apps/web/src/components/keyboard-shortcuts-help.tsx b/apps/web/src/components/keyboard-shortcuts-help.tsx
index 4c8bfff5..65f879a3 100644
--- a/apps/web/src/components/keyboard-shortcuts-help.tsx
+++ b/apps/web/src/components/keyboard-shortcuts-help.tsx
@@ -144,6 +144,7 @@ export const KeyboardShortcutsHelp = () => {
getKeybindingString,
validateKeybinding,
getKeybindingsForAction,
+ setIsRecording,
} = useKeybindingsStore();
// Get shortcuts from centralized hook
@@ -163,11 +164,11 @@ export const KeyboardShortcutsHelp = () => {
// Auto-save the new keybinding
const conflict = validateKeybinding(
keyString,
- recordingShortcut.action
+ recordingShortcut.action,
);
if (conflict) {
toast.error(
- `Key "${keyString}" is already bound to "${conflict.existingAction}"`
+ `Key "${keyString}" is already bound to "${conflict.existingAction}"`,
);
setRecordingKey(null);
setRecordingShortcut(null);
@@ -181,14 +182,16 @@ export const KeyboardShortcutsHelp = () => {
// Add new keybinding
updateKeybinding(keyString, recordingShortcut.action);
+ setIsRecording(false);
setRecordingKey(null);
setRecordingShortcut(null);
}
};
- const handleClickOutside = (e: MouseEvent) => {
+ const handleClickOutside = () => {
setRecordingKey(null);
setRecordingShortcut(null);
+ setIsRecording(false);
};
document.addEventListener("keydown", handleKeyDown);
@@ -211,6 +214,7 @@ export const KeyboardShortcutsHelp = () => {
const handleStartRecording = (keyId: string, shortcut: KeyboardShortcut) => {
setRecordingKey(keyId);
setRecordingShortcut(shortcut);
+ setIsRecording(true);
};
return (