From 226eed2a7f16c8f61619223445f4fce96aa62e7d Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 14 Feb 2022 23:38:29 +0000 Subject: [PATCH] Hide `Clear room list filter field` shortcut if new search enabled (#7798) --- src/accessibility/KeyboardShortcuts.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/accessibility/KeyboardShortcuts.ts b/src/accessibility/KeyboardShortcuts.ts index 93ea9f7124..0dfd441ae0 100644 --- a/src/accessibility/KeyboardShortcuts.ts +++ b/src/accessibility/KeyboardShortcuts.ts @@ -19,6 +19,7 @@ import { _td } from "../languageHandler"; import { isMac, Key } from "../Keyboard"; import { ISetting } from "../settings/Settings"; import SettingsStore from "../settings/SettingsStore"; +import IncompatibleController from "../settings/controllers/IncompatibleController"; export enum KeyBindingAction { /** Send a message */ @@ -396,6 +397,7 @@ const KEYBOARD_SHORTCUTS: IKeyboardShortcuts = { key: Key.ESCAPE, }, displayName: _td("Clear room list filter field"), + controller: new IncompatibleController("feature_spotlight", { key: null }), }, [KeyBindingAction.NextRoom]: { default: { @@ -591,7 +593,12 @@ export const getCustomizableShortcuts = (): IKeyboardShortcuts => { displayName: _td("Redo edit"), }; - return keyboardShortcuts; + return Object.keys(keyboardShortcuts).filter(k => { + return !keyboardShortcuts[k].controller?.settingDisabled; + }).reduce((o, key) => { + o[key] = keyboardShortcuts[key]; + return o; + }, {}); }; export const getKeyboardShortcuts = (): IKeyboardShortcuts => {