ui: restore Ctrl+B sidebar toggle shortcut (#25307)

This commit is contained in:
Pascal
2026-07-06 10:30:07 +02:00
committed by GitHub
parent 48719618e8
commit d80e878501
3 changed files with 11 additions and 1 deletions
@@ -27,7 +27,10 @@
let { onSearchClick = () => {} }: Props = $props(); let { onSearchClick = () => {} }: Props = $props();
const { handleKeydown } = useKeyboardShortcuts({ activateSearchMode: () => onSearchClick() }); const { handleKeydown } = useKeyboardShortcuts({
activateSearchMode: () => onSearchClick(),
toggleSidebar: () => toggleExpandedMode()
});
let isExpandedMode = $state(false); let isExpandedMode = $state(false);
let hoveredTooltip = $state<string | null>(null); let hoveredTooltip = $state<string | null>(null);
+1
View File
@@ -9,6 +9,7 @@ export enum KeyboardKey {
ARROW_LEFT = 'ArrowLeft', ARROW_LEFT = 'ArrowLeft',
ARROW_RIGHT = 'ArrowRight', ARROW_RIGHT = 'ArrowRight',
TAB = 'Tab', TAB = 'Tab',
B_LOWER = 'b',
D_LOWER = 'd', D_LOWER = 'd',
D_UPPER = 'D', D_UPPER = 'D',
E_UPPER = 'E', E_UPPER = 'E',
@@ -9,6 +9,7 @@ interface KeyboardShortcutsCallbacks {
deleteActiveConversation?: () => void; deleteActiveConversation?: () => void;
navigateToPrevConversation?: () => void; navigateToPrevConversation?: () => void;
navigateToNextConversation?: () => void; navigateToNextConversation?: () => void;
toggleSidebar?: () => void;
} }
export function useKeyboardShortcuts(callbacks: KeyboardShortcutsCallbacks) { export function useKeyboardShortcuts(callbacks: KeyboardShortcutsCallbacks) {
@@ -21,6 +22,11 @@ export function useKeyboardShortcuts(callbacks: KeyboardShortcutsCallbacks) {
callbacks.onSearchActivated?.(); callbacks.onSearchActivated?.();
} }
if (isCmdOrCtrl && event.key === KeyboardKey.B_LOWER) {
event.preventDefault();
callbacks.toggleSidebar?.();
}
if ( if (
isCmdOrCtrl && isCmdOrCtrl &&
event.shiftKey && event.shiftKey &&