From bb2c77261c282d867ecc7275a92c5c57a11ff1d0 Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Wed, 21 Jan 2026 13:29:59 -0800 Subject: [PATCH] feat: add keyboard shortcuts --- src/lib/components/HelpPanel.svelte | 9 +- .../components/KeyboardShortcutsModal.svelte | 173 ++++++++++++++++++ src/lib/components/PermissionModal.svelte | 14 ++ src/lib/components/StatusBar.svelte | 26 +++ src/routes/+page.svelte | 68 +++++++ 5 files changed, 282 insertions(+), 8 deletions(-) create mode 100644 src/lib/components/KeyboardShortcutsModal.svelte diff --git a/src/lib/components/HelpPanel.svelte b/src/lib/components/HelpPanel.svelte index 412c646..3ef2dae 100644 --- a/src/lib/components/HelpPanel.svelte +++ b/src/lib/components/HelpPanel.svelte @@ -43,14 +43,7 @@ "🔒 Grant tool permissions as needed for security", "📌 Pin important conversations for quick access", "🎨 Customize your theme and preferences in Settings", - ], - }, - { - title: "Keyboard Shortcuts", - items: [ - "Ctrl/Cmd + Enter: Send message", - "Ctrl/Cmd + K: Clear chat (when supported)", - "Escape: Close modals and panels", + "⌨️ Check the keyboard icon for available shortcuts", ], }, ]; diff --git a/src/lib/components/KeyboardShortcutsModal.svelte b/src/lib/components/KeyboardShortcutsModal.svelte new file mode 100644 index 0000000..4517184 --- /dev/null +++ b/src/lib/components/KeyboardShortcutsModal.svelte @@ -0,0 +1,173 @@ + + +
e.key === "Escape" && onClose()} +> +
e.stopPropagation()} + onkeydown={(e) => e.stopPropagation()} + role="dialog" + aria-labelledby="shortcuts-title" + tabindex="-1" + > +
+
+
+ + + + +
+

Keyboard Shortcuts

+
+ +
+ +
+ {#each shortcuts as section (section.category)} +
+

+ {section.category} +

+
+ {#each section.items as item (item.description)} +
+ {item.description} +
+ {#each item.keys as key, i (key)} + {#if i > 0} + + + {/if} + + {key} + + {/each} +
+
+ {/each} +
+
+ {/each} +
+
+
+ + diff --git a/src/lib/components/PermissionModal.svelte b/src/lib/components/PermissionModal.svelte index 01ebc46..2af9ced 100644 --- a/src/lib/components/PermissionModal.svelte +++ b/src/lib/components/PermissionModal.svelte @@ -109,8 +109,22 @@ Please continue where we left off and retry that action now that you have permis function isToolAlreadyGranted(toolName: string): boolean { return grantedToolsList.includes(toolName); } + + function handleKeydown(event: KeyboardEvent) { + if (!isVisible || !permission) return; + + if (event.key === "Enter") { + event.preventDefault(); + handleApproveAndReconnect(); + } else if (event.key === "Escape") { + event.preventDefault(); + handleDismiss(); + } + } + + {#if isVisible && permission}
+