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:
@ -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) {
|
||||
|
||||
@ -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',
|
||||
}
|
||||
|
||||
@ -3,4 +3,5 @@ export type CustomHotkeyScopes = {
|
||||
commandMenu?: boolean;
|
||||
commandMenuOpen?: boolean;
|
||||
keyboardShortcutMenu?: boolean;
|
||||
searchRecords?: boolean;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user