You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: [Browser] Keyboard focus is lost when switching between a terminal tab and a browser tab #20533
Switching from any other tab to a browser tab activates the browser tab visually, but native keyboard focus does not move into the page. Typing, keyboard scrolling, and Cmd+F do not reach the page until it is clicked.
The loss is one-directional. Switching from a browser tab back to a terminal tab works correctly: the terminal takes keyboard focus immediately and accepts input without an extra click. Only the browser pane fails to take focus on activation.
This looks like the same underlying cause described in #18832 and in PR #18834: tab activation alone does not transfer native keyboard focus to the guest.
Repro
Open a worktree with a terminal tab and a browser tab in the same tab strip.
Focus the terminal tab and type a character to confirm it has keyboard focus.
Switch to the browser tab (tab strip click / Ctrl+Tab / Cmd+number).
Without clicking inside the page, press arrow keys, Space, or Cmd+F.
Actual: The browser tab renders as active, but keystrokes are dropped or still delivered to the previously focused surface. A click inside the page is required before any input reaches it.
Expected: Activating a browser tab moves native keyboard focus into its page, so scrolling and typing work immediately without an extra click.
Counter-case (works as expected)
From the browser tab above, click inside the page so it holds focus.
Switch back to the terminal tab.
Without clicking the terminal, type a character. Input reaches the terminal normally.
So "this pane became active" is the focus trigger. Nothing has to ask.
The browser guest only focuses when someone queued a request for it.useBrowserPageChromeFocus has an isActive-gated effect, and its first act is to look for a queued request:
The tab-strip runtime model does not, and neither does anything else on the plain-activation path. So a tab-strip click, Ctrl+Tab and Cmd+<n> all leave the guest unfocused, while the same destination reached through the omnibox takes focus correctly.
Worth checking against your repro: switching to the browser tab through the omnibox instead of the tab strip should work today. If it does, that confirms the split above and narrows the fix to the activation path rather than the guest-attach timing #18834 is about.
Two ways to close it, and the thing either must not break
Queue at the activation sites — mirror what open-tab-selection-routing.ts already does, wherever the tab strip sets the active tab. Explicit, but it is one call per entry point and a new entry point will forget it. That is how this one was born.
Focus on becoming active in the hook — give useBrowserPageChromeFocus the same "activation is the trigger" rule the terminal has, with the queued request staying an override rather than a precondition. One place, and new activation paths get it for free.
(2) has a guard it must not lose: a new blank tab has to keep landing in the address bar with its text selected, which today works because that path queues an address-bar request. Under (2) the fallback has to fire only when nothing is queued and the address bar is not already held — keepAddressBarFocusRef and the in-flight grab are both right there to read. Getting that wrong would yank focus out of the bar mid-typing whenever isActive re-fires.
Overlap worth knowing before anyone starts
PR #18834 is open and edits this same hook (it adds peekBrowserFocusRequest to use-browser-page-chrome-focus.ts). Its subject is different — focusing a newly opened foreground tab once its guest attaches — but a fix for this issue written against main will conflict with it. Whoever takes this should probably stack on #18834 rather than race it.
I have not opened a PR for exactly that reason; happy to do so if a maintainer says which of (1)/(2) you want and whether to base it on #18834.
Investigated with Claude Code; the file/line claims above are from reading and grepping the tree at 8e26d516, not from running the desktop app — I have no way to reproduce the focus behaviour itself here, which is why the omnibox counter-check above is worth a maintainer's ten seconds.
Works (focus lands in the page): Cmd+J palette → browser tab. Arrow keys and Space scroll immediately, no click needed.
Fails (no focus): tab strip click, and Ctrl+Tab (bound to Previous recent tab in my keymap). Page stays unfocused until clicked.
Same destination tab in all three cases, same session, terminal tab focused before each attempt.
So your read looks right: the palette path is the only one queuing a focus request, and plain activation leaves the guest unfocused.
On the two options — (2) reads better from a reporter's seat, since (1) is exactly the shape that produced this gap: Ctrl+Tab and the tab strip are separate entry points and both were missed. Not my call on the guard trade-off, though.
Keymap note in case it matters for enumerating entry points: Tab Navigation has Next/Previous tab (same type), Next/Previous tab (all types), Previous recent tab, Next/Previous terminal tab, and Select Tab 1–9 — several distinct activation paths, all presumably on the unfocused side.
Activity
L4XB commentedon Sep 14, 2026
Traced this on
main(8e26d516). The asymmetry you describe is structural, not a timing race, and it is narrower than "the same cause as #18832".The two panes take focus in different ways
The terminal focuses itself from its own activation.
TerminalPaneRuntimePortals.tsxpasses the flag straight down:So "this pane became active" is the focus trigger. Nothing has to ask.
The browser guest only focuses when someone queued a request for it.
useBrowserPageChromeFocushas anisActive-gated effect, and its first act is to look for a queued request:Nothing queued → it returns, and becoming active focuses nothing.
Which is why the omnibox works and the tab strip does not
Inside
src/renderer/src/components/tab-bar/, exactly one non-test file callsrequestBrowserFocus:open-tab-selection-routing.ts, the omnibox "switch to tab" path —The tab-strip runtime model does not, and neither does anything else on the plain-activation path. So a tab-strip click,
Ctrl+TabandCmd+<n>all leave the guest unfocused, while the same destination reached through the omnibox takes focus correctly.Worth checking against your repro: switching to the browser tab through the omnibox instead of the tab strip should work today. If it does, that confirms the split above and narrows the fix to the activation path rather than the guest-attach timing #18834 is about.
Two ways to close it, and the thing either must not break
open-tab-selection-routing.tsalready does, wherever the tab strip sets the active tab. Explicit, but it is one call per entry point and a new entry point will forget it. That is how this one was born.useBrowserPageChromeFocusthe same "activation is the trigger" rule the terminal has, with the queued request staying an override rather than a precondition. One place, and new activation paths get it for free.(2) has a guard it must not lose: a new blank tab has to keep landing in the address bar with its text selected, which today works because that path queues an
address-barrequest. Under (2) the fallback has to fire only when nothing is queued and the address bar is not already held —keepAddressBarFocusRefand the in-flight grab are both right there to read. Getting that wrong would yank focus out of the bar mid-typing wheneverisActivere-fires.Overlap worth knowing before anyone starts
PR #18834 is open and edits this same hook (it adds
peekBrowserFocusRequesttouse-browser-page-chrome-focus.ts). Its subject is different — focusing a newly opened foreground tab once its guest attaches — but a fix for this issue written againstmainwill conflict with it. Whoever takes this should probably stack on #18834 rather than race it.I have not opened a PR for exactly that reason; happy to do so if a maintainer says which of (1)/(2) you want and whether to base it on #18834.
Investigated with Claude Code; the file/line claims above are from reading and grepping the tree at
8e26d516, not from running the desktop app — I have no way to reproduce the focus behaviour itself here, which is why the omnibox counter-check above is worth a maintainer's ten seconds.kimdane0115 commentedon Sep 15, 2026
Confirmed — the split is real.
Works (focus lands in the page): Cmd+J palette → browser tab. Arrow keys and Space scroll immediately, no click needed.
Fails (no focus): tab strip click, and Ctrl+Tab (bound to Previous recent tab in my keymap). Page stays unfocused until clicked.
Same destination tab in all three cases, same session, terminal tab focused before each attempt.
So your read looks right: the palette path is the only one queuing a focus request, and plain activation leaves the guest unfocused.
On the two options — (2) reads better from a reporter's seat, since (1) is exactly the shape that produced this gap: Ctrl+Tab and the tab strip are separate entry points and both were missed. Not my call on the guard trade-off, though.
Keymap note in case it matters for enumerating entry points: Tab Navigation has Next/Previous tab (same type), Next/Previous tab (all types), Previous recent tab, Next/Previous terminal tab, and Select Tab 1–9 — several distinct activation paths, all presumably on the unfocused side.
AmethystLiang commentedon Sep 16, 2026
thanks for reporting. looking into it
feat(browser): keep Orca shortcuts, split focus and back/forward work…
feat(browser): keep Orca shortcuts, split focus and back/forward work…
feat(browser): keep Orca shortcuts, split focus and back/forward work…
feat(browser): keep Orca shortcuts, split focus and back/forward work…
feat(browser): make Orca shortcuts, split focus and mouse back/forwar…
feat(browser): make Orca shortcuts, split focus and mouse back/forwar…