From 989b3d2b198ba0188aef83e92d062fdfd7f27c37 Mon Sep 17 00:00:00 2001 From: Anjula Karunarathne Date: Fri, 28 Aug 2020 18:04:25 +0530 Subject: [PATCH] Fix not being allowed to disable shortcuts --- ElectronClient/gui/KeymapConfig/KeymapConfigScreen.tsx | 6 ++++-- ElectronClient/gui/KeymapConfig/ShortcutRecorder.tsx | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ElectronClient/gui/KeymapConfig/KeymapConfigScreen.tsx b/ElectronClient/gui/KeymapConfig/KeymapConfigScreen.tsx index 55a5ed2310a..29dafdd9203 100644 --- a/ElectronClient/gui/KeymapConfig/KeymapConfigScreen.tsx +++ b/ElectronClient/gui/KeymapConfig/KeymapConfigScreen.tsx @@ -62,7 +62,9 @@ export const KeymapConfigScreen = ({ themeId }: KeymapConfigScreenProps) => { return (recorderError && ); } else if (hovering[commandName]) { return (); - } else { return null; } + } else { + return null; + } }; const renderError = (error: KeymapError) => { @@ -89,7 +91,7 @@ export const KeymapConfigScreen = ({ themeId }: KeymapConfigScreenProps) => { onReset={handleReset} onCancel={handleCancel} onError={handleError} - initialAccelerator={accelerator} + initialAccelerator={accelerator || ''} commandName={command} themeId={themeId} /> : diff --git a/ElectronClient/gui/KeymapConfig/ShortcutRecorder.tsx b/ElectronClient/gui/KeymapConfig/ShortcutRecorder.tsx index fb1ff66e80f..f2c4308b85f 100644 --- a/ElectronClient/gui/KeymapConfig/ShortcutRecorder.tsx +++ b/ElectronClient/gui/KeymapConfig/ShortcutRecorder.tsx @@ -25,8 +25,11 @@ export const ShortcutRecorder = ({ onSave, onReset, onCancel, onError, initialAc useEffect(() => { try { - keymapService.validateAccelerator(accelerator); - keymapService.validateKeymap({ accelerator, command: commandName }); + if (accelerator) { + keymapService.validateAccelerator(accelerator); + keymapService.validateKeymap({ accelerator, command: commandName }); + } + // Discard previous errors onError({ recorderError: null }); setSaveAllowed(true);