feat(ui): add Cmd+K shortcuts dialog and Cmd+L chat focus#2722
feat(ui): add Cmd+K shortcuts dialog and Cmd+L chat focus#2722
Conversation
Add a centralized keyboard shortcuts definition file and a dialog that displays all available shortcuts, triggered by Cmd+K globally. - Create keyboard-shortcuts.ts with shortcut definitions, groups, and cross-platform helpers (isModKey, isMac) - Create KeyboardShortcutsDialog component using Radix Dialog - Register global Cmd+K listener in ShellLayout (works even from contenteditable inputs) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a global Cmd+L shortcut that focuses the chat input from anywhere in the app. Shows a "⌘L to focus" hint that auto-hides when the input is focused using CSS group-focus-within. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
🧪 BenchmarkShould we run the Virtual MCP strategy benchmark for this PR? React with 👍 to run the benchmark.
Benchmark will run on the next push after you react. |
Release OptionsShould a new version be published when this PR is merged? React with an emoji to vote on the release type:
Current version: Deployment
|
There was a problem hiding this comment.
2 issues found across 4 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/mesh/src/web/layouts/shell-layout.tsx">
<violation number="1" location="apps/mesh/src/web/layouts/shell-layout.tsx:186">
P2: Guard the global `Cmd/Ctrl+L` handler so it only prevents default when a chat input is actually available to focus.</violation>
</file>
<file name="apps/mesh/src/web/components/chat/input.tsx">
<violation number="1" location="apps/mesh/src/web/components/chat/input.tsx:356">
P2: This adds a new `useEffect` by suppressing the repo's `ban-use-effect` rule instead of using an allowed pattern.
(Based on your team's feedback about avoiding `useEffect` in this codebase.) [FEEDBACK_USED]</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
The Cmd+L shortcut now registers directly in ChatInput instead of being dispatched via a custom event from the shell layout. This ensures the shortcut only works when the chat input is actually rendered. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/mesh/src/web/layouts/shell-layout.tsx">
<violation number="1" location="apps/mesh/src/web/layouts/shell-layout.tsx:174">
P2: Removing the shell-level `Cmd/Ctrl+L` path makes the advertised focus-chat shortcut stop working on routes where `ChatInput` is not mounted, such as the project home route.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| // oxlint-disable-next-line ban-use-effect/ban-use-effect | ||
| useEffect(() => { | ||
| const handler = (e: globalThis.KeyboardEvent) => { | ||
| if (isModKey(e) && e.code === "KeyK") { |
There was a problem hiding this comment.
P2: Removing the shell-level Cmd/Ctrl+L path makes the advertised focus-chat shortcut stop working on routes where ChatInput is not mounted, such as the project home route.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/mesh/src/web/layouts/shell-layout.tsx, line 174:
<comment>Removing the shell-level `Cmd/Ctrl+L` path makes the advertised focus-chat shortcut stop working on routes where `ChatInput` is not mounted, such as the project home route.</comment>
<file context>
@@ -171,22 +171,10 @@ function ShellLayoutContent() {
- (e.target as HTMLElement).isContentEditable;
-
- if (e.code === "KeyK") {
+ if (isModKey(e) && e.code === "KeyK") {
e.preventDefault();
setShortcutsDialogOpen(true);
</file context>
What is this contribution about?
Add keyboard shortcut discoverability to the Mesh UI:
ChatInputso it only works when the chat is rendered.keyboard-shortcuts.ts), with cross-platform support (⌘ on Mac, Ctrl elsewhere)Files changed
apps/mesh/src/web/lib/keyboard-shortcuts.ts— centralized shortcut definitions, groups, andisModKey/isMachelpersapps/mesh/src/web/components/keyboard-shortcuts-dialog.tsx— Dialog component rendering grouped shortcuts with<kbd>elementsapps/mesh/src/web/layouts/shell-layout.tsx— global Cmd+K keydown listenerapps/mesh/src/web/components/chat/input.tsx— Cmd+L focus listener and hint labelScreenshots/Demonstration
N/A
How to Test
bun run --cwd=apps/mesh dev:clientMigration Notes
N/A — no database or configuration changes.
Review Checklist