Repository navigation
feat(chat): focus the composer when the ⌘M chat view opens - #1163
Open
probertson wants to merge 1 commit into
Open
probertson wants to merge 1 commit into
probertson wants to merge 1 commit into
Conversation
Entering the view blurred the xterm and left focus nowhere, so the user had to click the composer before typing. The composer now takes focus on entry — when focus was nowhere, inside this node, or in a terminal; a text field elsewhere keeps it. The ChatPanel is code-split, so on a first open (and while a dialog keeps the composer disabled) the request waits for the composer to mount/enable; leaving the view cancels it. Exit still restores the terminal under the existing rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Opening the ⌘M chat view now puts the keyboard in its composer, so you can start typing straight away. Before, entering the view blurred the terminal and left focus nowhere, and you had to click the composer first.
When it takes focus: only if focus was nowhere, already inside this node, or in a terminal. A text field elsewhere (a rename box, the sessions filter, another node's composer) keeps it. Opening the output view (agents without a chat view) changes nothing.
Timing: ChatPanel is code-split. On the first open the composer mounts after the view's entry has already run, so the entry leaves a request that the composer takes when it mounts. If a dialog keeps the composer disabled (e.g. Claude's folder-trust prompt), it takes the request when it becomes enabled. Leaving the view cancels the request. Exit still returns focus to the terminal under the existing rule.
The kanban card modal uses the same hook (
useMdModeFocus), so it gets the same behavior.How it was checked
useMdModeFocus.test.tsx: composer already mounted, composer mounted later, request taken once, request cancelled on exit, a second mount of the same session elsewhere ignored, a text field elsewhere left alone, no focus when the view is already open at mount, disabled then enabled, terminal restored on exit.npm run typecheckand the terminal/nodes/kanban suites (1587 tests) pass.Not checked: the ⌘K palette entry and the kanban card modal specifically.
🤖 Generated with Claude Code