Repository navigation
fix(app): make Cmd/Ctrl+N start a new session from the composer - #6470
Merged
Merged
Conversation
Cmd/Ctrl+N was ignored whenever an input, textarea or contenteditable had focus (`!inEditable` guard). The chat composer is focused almost all the time, so the shortcut silently did nothing. It was also gated on `canCreateTask` (client connected, not loading, model available), while the command palette's "New session" only needs a selected workspace, even though both now just open the navigation-only new-session draft. - Add isNewSessionShortcut (Mod+N, no Shift/Alt/AltGr, OS-aware). - Handle it in a capture-phase keydown listener so editor handlers cannot swallow it; an open modal dialog still keeps the key; key repeat does not open one draft per repeat. - Cmd/Ctrl+N and the palette now call the same createNewSessionInSelectedWorkspace callback. - Rename the settings shortcuts row "New chat" to "New session". No native menu accelerator binds CmdOrCtrl+N, so nothing in the Electron main process intercepts the key.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
Contributor
OpenWork evidence
Run details · Open the preview to inspect evidence and sandbox options. |
Contributor
There was a problem hiding this comment.
Warden clearance. Complete security and confidentiality review of 5c7da5d3731d242c10e717709084a3ce72949433 found no high or medium security findings and no confidentiality findings. Any new push dismisses this approval. Analysis run
Contributor
Warden: approvedNo high or medium security findings and no confidentiality findings. Reviewed |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this about?
Cmd+N (Ctrl+N on Windows/Linux) in the desktop app now always starts a new session, just like Cmd+K → "New session".
What problem does it solve?
Pressing Cmd+N usually did nothing, so people fell back to the command palette or the sidebar button.
What was the situation before?
With the cursor in the chat composer (nearly always), Cmd+N was silently ignored. It also did nothing when the selected model was unavailable or the workspace was still loading, even though the palette's "New session" worked.
How is this implemented?
shell/new-session-shortcut.ts: pureisNewSessionShortcut(Mod+N, OS-aware, no Shift/Alt/AltGr).shell/use-shell-shortcuts.ts: handled in a capture-phase keydown listener (like Cmd+1–9), no longer skipped in text fields; an open modal dialog keeps the key; key repeat opens one draft.shell/session-route.tsx: Cmd+N and the palette sharecreateNewSessionInSelectedWorkspace; the hook takesonCreateNewSessioninstead ofcanCreateTask/workspaceId/onCreateTask.What else changed?
Release note
Cmd+N (Ctrl+N) now starts a new session even while you're typing in the chat box.
Evidence
No E2E spec changed.
apps/app/tests/new-session-shortcut.test.tsxcovers the predicate, focused composer/input, an editor that stops propagation, key repeat, and an open dialog. Also checked by hand indev-app-webover CDP: from an existing session with the composer focused, Cmd+N opens the new-session draft and the composer stays focused. With the palette open, Cmd+N does nothing.