Skip to content

Commit d80e878

Browse files
ui: restore Ctrl+B sidebar toggle shortcut (ggml-org#25307)
1 parent 4871961 commit d80e878

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

tools/ui/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigation.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727
2828
let { onSearchClick = () => {} }: Props = $props();
2929
30-
const { handleKeydown } = useKeyboardShortcuts({ activateSearchMode: () => onSearchClick() });
30+
const { handleKeydown } = useKeyboardShortcuts({
31+
activateSearchMode: () => onSearchClick(),
32+
toggleSidebar: () => toggleExpandedMode()
33+
});
3134
3235
let isExpandedMode = $state(false);
3336
let hoveredTooltip = $state<string | null>(null);

tools/ui/src/lib/enums/keyboard.enums.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export enum KeyboardKey {
99
ARROW_LEFT = 'ArrowLeft',
1010
ARROW_RIGHT = 'ArrowRight',
1111
TAB = 'Tab',
12+
B_LOWER = 'b',
1213
D_LOWER = 'd',
1314
D_UPPER = 'D',
1415
E_UPPER = 'E',

tools/ui/src/lib/hooks/use-keyboard-shortcuts.svelte.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ interface KeyboardShortcutsCallbacks {
99
deleteActiveConversation?: () => void;
1010
navigateToPrevConversation?: () => void;
1111
navigateToNextConversation?: () => void;
12+
toggleSidebar?: () => void;
1213
}
1314

1415
export function useKeyboardShortcuts(callbacks: KeyboardShortcutsCallbacks) {
@@ -21,6 +22,11 @@ export function useKeyboardShortcuts(callbacks: KeyboardShortcutsCallbacks) {
2122
callbacks.onSearchActivated?.();
2223
}
2324

25+
if (isCmdOrCtrl && event.key === KeyboardKey.B_LOWER) {
26+
event.preventDefault();
27+
callbacks.toggleSidebar?.();
28+
}
29+
2430
if (
2531
isCmdOrCtrl &&
2632
event.shiftKey &&

0 commit comments

Comments
 (0)