Repository navigation
feat(browser): add a shortcut to open a browser tab in a split to the right - #35994
Conversation
[Medium impact] The latest changes appear safe to merge. SummaryAdds a bindable action and palette entry to open a browser in a split to the right.
Reviews (2) · Last reviewed commit: "fix(browser): keep new-browser handlers ..." · Reviewed by Greptile |
|
No actionable comments were generated in the recent review.
|
rahul05ranjan
left a comment
There was a problem hiding this comment.
I traced the new shortcut end to end and the wiring is consistent everywhere I checked:
- Keydown parity: the
tab.newBrowserSplitRightbranch interminal-workspace-keydown.tsmirrors the adjacenttab.newBrowserbranch exactly (repeat guard,preventDefault,notifyTerminalCapture,floatingWorkspaceFocused+ensureClientCreationActionAllowed(..., 'managed-browser')gate), so the two paths won't drift in behavior. - Binding choice:
Mod+Alt+Bdoesn't collide with any existing darwin binding — I checked the definition files; the Mod+Alt namespace currently holds T, W, Shift+E, arrows and brackets, but not B. The macOS-only default with the AltGr comment matches the pattern of other darwin-only chords in the same file. - The wrapper split in
use-terminal-create-actions.tsis the right call. The oldhandleNewBrowserTabwas a zero-arg callback, so menu code passing it as a select handler was harmless;openNewBrowserTab(splitDirection?)would have received the select event as its first argument if passed the same way, and the comment records exactly that hazard. Both menu-facing callbacks now go through() => ...wrappers. - Placement either/or is explicit and matches the contract:
...(split ? { split } : { targetGroupId: groupId })inbrowser-tab-actions.tslines up with the documentedCreateBrowserTabOptionssemantics ("split wins over targetGroupId"), and the paired-runtime path goes throughresolveWebRuntimeBrowserClientTargetGroup, which pre-creates a client-only split group (activate: false) and dropstargetGroupId— consistent with the host-unknown-group comment there. - The
shortcut-row-visibility/shortcuts-searchfilters now hidetab.newBrowserSplitRightalongsidetab.newBrowserwhen managed browser creation is off, which would otherwise leave a row that silently does nothing.
Two small notes:
- Degraded fallback when there's no group to split beside: in
openNewBrowserTab, when the worktree has no active/first group, the flow falls through to the no-workspace path, which callscreateBrowserTab/createWebRuntimeSessionBrowserTabwith no split at all — the "split right" action quietly becomes a plain new tab. That's probably the right behavior (nothing to split beside), but a user on an empty workspace hitting the shortcut or the Cmd-J action gets no visual indication of why. Fine to leave, just flagging it's silent. - The new placement test covers the local-desktop split layout nicely; the paired-runtime split path (
createEmptySplitGroup+clientTargetGroupCreatedcleanup on failed creation) is exercised only via the pre-existing resolver's other callers. If a follow-up test ofopenNewBrowserTabInActiveWorkspacewith a paired-runtime provider and a split is ever cheap, this call site would be where it belongs.
ELI5
You can now press a key to open a browser next to your terminal instead of on top of it. On macOS it's Cmd+Opt+B, and it can be rebound in Settings → Keyboard. It's also in the Cmd+J palette as "New Browser Tab in Right Split".
What Changed
Before: Cmd+Shift+B (
tab.newBrowser) always added the browser as another tab in the active pane, which hid the terminal. Putting a browser on the right meant dragging the tab with the mouse. Settings had no action to bind a key to.After: a new action,
tab.newBrowserSplitRight("New browser tab in right split"), opens a new browser tab in a new pane to the right of the active pane. The terminal stays visible and the new pane gets focus. Cmd+Shift+B behaves as before.How:
browser-tab-actions.ts):openNewBrowserTabInActiveWorkspace(groupId, splitDirection?)takes an optional direction.splittocreateBrowserTab, which already supports it, including through the main-owned layout path.resolveWebRuntimeBrowserClientTargetGroup, the same helper link routing uses for "open to the side".definitions-core-2.ts,types.ts):tab.newBrowserSplitRightin the Tabs group.tab.newAgentDefaultandeditor.addReviewNote).sync:localization-catalog.Why
The UI could already create a pane with a browser in it (link routing, "open to the side"). The only thing missing was a bindable action that asks for it. Giving the existing store owner one optional argument reuses that split path on every route, instead of creating an empty group and then filling it from the keyboard handler. That would fail in builds where main owns the layout, because the new group isn't in the window until main's frame arrives.
Only "right" is added, as the issue asks. Left, down and up would each be a one-line definition plus a branch if wanted later. The floating workspace panel claims the chord and does nothing, the same as
tab.newSimulator, because it has its own shortcut system.Linked Issue
Fixes #32222
Visual Proof
Hidden macOS dev build. BEFORE is origin/main (the changed files checked out at the base commit, main process rebuilt); AFTER is this branch.
Settings → Keyboard, searched for "browser":
Palette, "browser split":
Testing
Manual, hidden macOS dev build (store read after each press):
Automated:
browser-tab-creation-placement.test.tsadds one case:openNewBrowserTabInActiveWorkspace(G1, 'right')leaves G1's tabs alone and puts the new browser in a new group split beside G1. It fails without the store change and passes withORCA_LAYOUT_OWNERset tomainand unset. Ran the focused keybinding, settings, palette, terminal keydown/create-action and browser store tests, pluscheck:code-quality:changed,check:react-doctor:changedandverify:localization-catalog.Not run on Linux or Windows. Those platforms only get an unbound action, with no default chord.
AI Disclosure
Review
Codex and Claude reviewed it. Fixed: the new test found the created tab by array position, which broke when main owns the layout. It now finds the tab by id. Not changed: in a paired workspace whose layout is drawn by server frames under the off-by-default
ORCA_LAYOUT_OWNER=mainbuild, a client-only split group can be folded back into a server group. That build is off in shipped builds (layout-owner-switch.ts), and link routing's "open to the side" goes through the same helper with the same limit, so it belongs to the layout-owner migration, not this PR.Agent skill upstream boundary
Notes
createBrowserTab({ split })path. Paired runtimes use link routing's client split group, and no new RPC fields are sent, so mixed client and host versions are unaffected.To try (waiting for blessing): dev build from
/Users/kelvinamoaba/orca/workspaces/orca/browser-split-shortcut.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)