Repository navigation
Make a split pane active when keyboard focus enters it - #7971
Merged
Merged
Conversation
Main split panes became active only on pointerdown. When the caret reached another pane's composer without a click (Tab, or a plugin calling composer.focus()), the active pane stayed behind, so the active-composer rule from #7960 sent composer.focus and the model picker chords to the other pane's composer. The pane wrapper now also becomes active on focus capture, except while hidden behind a maximized pane, without cancelling a pending keyboard focus request. That exposed a mount race: every composer autofocuses on mount, so on reload whichever split pane's editor was ready last took the caret and, now, the active pane and URL. ComposerBox suppresses autofocus for a composer that mounts in an unfocused split pane. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Human comments
What was wrong
Main-area split panes became active only on
pointerdown(SplitThreadArea's pane wrapper). When the caret reached another pane's composer without a click (Tab across panes, or a plugin callingcomposer.focus()on auseComposers()handle there), the active pane stayed behind. #7960's active-composer rule only accepts a caret composer on the focused surface, so ⇧⌘M opened the other pane's model picker and ⇧⌘C pulled the caret over to the other pane. Before #7960 both shortcuts did nothing in that state. The side-panel split (SidebarSplitContainer) already follows focus withonFocusCapture.What changed
SplitThreadArea.tsx: the pane wrapper also becomes active on focus capture, through a newonFocusWithinPanethat callsfocusPaneonly. The pointer handler still also clears a pending keyboard focus request. Focus capture must not clear it, becausepane.focus.*focuses the pane root while its composer is not ready. A pane hidden behind a maximized pane doesn't take focus this way.ComposerBox.tsx: a composer that mounts in an unfocused split pane getsautoFocus: false. Every composer autofocuses on mount (PromptBoxInternaldefaultsautoFocusto true), so on reload whichever pane's editor was ready last took the caret. On main that left the caret in an inactive pane. With focus following, it would also have switched the active pane and the URL. The check uses the pane state at mount, so making a pane active later doesn't pull the caret into its composer.How you verified
SplitThreadArea.test.tsxcase: focusing a textarea in the other pane makes that pane active and moves the URL, and focus inside a pane hidden by maximize changes nothing. It fails without theonFocusCapturehandler.PromptBoxInternal.test.tsxcase: a composer mounted in an unfocused split pane doesn't take the caret, even after its pane becomes focused. It fails without theComposerBoxchange.pnpm exec turbo run typecheck lint test --filter=@bb/app: 700 test files, 7336 tests passed.pnpm start:worktree, with a thread split beside New thread:ComposerBoxchange flipped to the New thread pane on reload.🤖 Generated with Claude Code