Fix shortcuts inconsistencies (#12624)

Fixes https://github.com/twentyhq/core-team-issues/issues/1093

The search shortcut and the go to shortcuts were not always available.
They worked after a refresh but not when clicking outside of a table or
a board, or when a table row or board card was focus.
This PR fixes this:


https://github.com/user-attachments/assets/f454037b-9dfd-4f9c-9124-43f4b8b5cec8
This commit is contained in:
Raphaël Bosi
2025-06-16 16:10:27 +02:00
committed by GitHub
parent e41d2f9f53
commit ed1593c089
13 changed files with 58 additions and 7 deletions

View File

@ -19,7 +19,9 @@ const areCustomScopesEqual = (
customScopesA?.commandMenu === customScopesB?.commandMenu &&
customScopesA?.commandMenuOpen === customScopesB?.commandMenuOpen &&
customScopesA?.goto === customScopesB?.goto &&
customScopesA?.keyboardShortcutMenu === customScopesB?.keyboardShortcutMenu
customScopesA?.keyboardShortcutMenu ===
customScopesB?.keyboardShortcutMenu &&
customScopesA?.searchRecords === customScopesB?.searchRecords
);
};
@ -60,6 +62,7 @@ export const useSetHotkeyScope = () =>
commandMenuOpen: customScopes?.commandMenuOpen ?? true,
goto: customScopes?.goto ?? false,
keyboardShortcutMenu: customScopes?.keyboardShortcutMenu ?? false,
searchRecords: customScopes?.searchRecords ?? false,
},
};
@ -81,6 +84,10 @@ export const useSetHotkeyScope = () =>
scopesToSet.push(AppHotkeyScope.KeyboardShortcutMenu);
}
if (newHotkeyScope?.customScopes?.searchRecords === true) {
scopesToSet.push(AppHotkeyScope.SearchRecords);
}
scopesToSet.push(newHotkeyScope.scope);
if (DEBUG_HOTKEY_SCOPE) {

View File

@ -3,6 +3,7 @@ export enum AppHotkeyScope {
Goto = 'goto',
CommandMenu = 'command-menu',
CommandMenuOpen = 'command-menu-open',
SearchRecords = 'search-records',
KeyboardShortcutMenu = 'keyboard-shortcut-menu',
KeyboardShortcutMenuOpen = 'keyboard-shortcut-menu-open',
}

View File

@ -3,4 +3,5 @@ export type CustomHotkeyScopes = {
commandMenu?: boolean;
commandMenuOpen?: boolean;
keyboardShortcutMenu?: boolean;
searchRecords?: boolean;
};