Repository navigation
feat(web): add Ctrl+Tab MRU thread switcher with glass HUD - #46124
lucas-ventura wants to merge 1 commit into
Conversation
|
This PR changes the test suite by +10 test cases (browser +3, unit +7, server 0). New browser test files: Keep tests that would fail for a real reason, and test logic below the UI where it can be. See Testing. |
| const unsubscribeDrafts = useComposerDraftStore.subscribe(() => | ||
| recordCurrentRouteVisit(router), | ||
| ); | ||
| window.addEventListener("keyup", onKeyUp, true); |
There was a problem hiding this comment.
🟡 Medium components/RecentThreadSwitcher.tsx:293
Releasing Ctrl inside a rendered HTML document never reaches this parent window keyup listener, so commitSelected() is not called and the HUD stays open instead of navigating to the selected thread. The frame bridge forwards only keydown; forward modifier keyup events to the parent or otherwise deliver the release to this listener.
Also found in 1 other location(s)
apps/web/src/components/files/BrowserDocumentFrame.tsx:75
Forwarding these commands starts a switcher session that cannot finish from the focused HTML preview.
BrowserDocumentFramereplays onlykeydown, and the HTML bootstrap inpackages/shared/src/htmlRender.tsforwards nokeyup;RecentThreadSwitcherwaits for the parent window'skeyupto commit and never moves focus out of the iframe. Thus Ctrl+Tab inside a rendered document leaves the HUD open instead of switching when Ctrl is released (even a quick tap). Escape/Enter are not forwarded either. MDN'sElement: keyup eventdocuments that key events target the focused element and bubble to its Document/Window. Forward modifier releases as well, or transfer focus/handle these commands without a hold session.
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/web/src/components/RecentThreadSwitcher.tsx around line 293:
Releasing Ctrl inside a rendered HTML document never reaches this parent `window` `keyup` listener, so `commitSelected()` is not called and the HUD stays open instead of navigating to the selected thread. The frame bridge forwards only `keydown`; forward modifier `keyup` events to the parent or otherwise deliver the release to this listener.
Also found in 1 other location(s):
- apps/web/src/components/files/BrowserDocumentFrame.tsx:75 -- Forwarding these commands starts a switcher session that cannot finish from the focused HTML preview. `BrowserDocumentFrame` replays only `keydown`, and the HTML bootstrap in `packages/shared/src/htmlRender.ts` forwards no `keyup`; `RecentThreadSwitcher` waits for the parent window's `keyup` to commit and never moves focus out of the iframe. Thus Ctrl+Tab inside a rendered document leaves the HUD open instead of switching when Ctrl is released (even a quick tap). Escape/Enter are not forwarded either. MDN's `Element: keyup event` documents that key events target the focused element and bubble to its Document/Window. Forward modifier releases as well, or transfer focus/handle these commands without a hold session.
| environmentThreadShells.delegatedUnderParentAtom, | ||
| ); | ||
| const candidates: RecentThreadCandidate[] = []; | ||
| for (const thread of shells) { |
There was a problem hiding this comment.
🟡 Medium components/RecentThreadSwitcher.tsx:75
Moved handoff sources remain in the MRU candidate list, so after thread A moves to B, Ctrl+Tab can select stale A and ThreadHandoffFollower redirects back to B instead of reaching the previous distinct thread. This loop filters deleted, archived, and parented shells but not moved copies; exclude keys in movedThreadCopyKeys, matching navigationThreadShellsAtom.
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/web/src/components/RecentThreadSwitcher.tsx around line 75:
Moved handoff sources remain in the MRU candidate list, so after thread A moves to B, `Ctrl+Tab` can select stale A and `ThreadHandoffFollower` redirects back to B instead of reaching the previous distinct thread. This loop filters deleted, archived, and parented shells but not moved copies; exclude keys in `movedThreadCopyKeys`, matching `navigationThreadShellsAtom`.
ApprovabilityVerdict: Needs Human Approval Macroscope's review found this PR requires human approval — Adds a recent-thread switcher with default desktop Ctrl+Tab shortcuts and a new line-level lint suppression, both requiring human review. Two supplied Medium findings also flag preview-frame completion and moved-thread navigation issues. Needs human approval because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
|
Thanks for this. #36480 makes the same change and is the one being kept. #36480 already adds the same quick-toggle and hold-to-cycle Ctrl+Tab interaction. It also reuses the app’s command surface and sidebar status components, keeping thread status and environment information consistent with the rest of the app. Your glass HUD offers a different presentation, but the underlying feature overlaps. Please bring any remaining interaction improvements to that pull request so we can review one implementation. Closing as a duplicate. |
Problem
Switching rapidly between the two most recently used threads (or cycling back through recently visited threads across projects) currently requires stepping linearly through the sidebar (
mod+shift+[/mod+shift+]) or using numbered jumps (mod+1–9). There is noCtrl+Tab/Ctrl+Shift+Tabmost-recently-used (MRU) switcher like Arc or desktop editors provide.Change
Adds an MRU recent-thread switcher triggered by
Ctrl+Tab(thread.recentNext) andCtrl+Shift+Tab(thread.recentPrevious):packages/contracts/src/keybindings.ts,packages/shared/src/keybindings.ts,apps/web/src/keybindings.ts,apps/web/src/components/settings/KeybindingsSettings.logic.ts,apps/web/src/components/files/BrowserDocumentFrame.tsx):thread.recentNext(ctrl+tab) andthread.recentPrevious(ctrl+shift+tab) scoped toisDesktop && !terminalFocusby default so web browsers keep native tab switching and terminals keepCtrl+Tab.apps/web/src/i18n/translations/*.json), forwards them fromBrowserDocumentFrame, and treats them as thread navigation shortcuts inisThreadNavigationShortcut.apps/web/src/components/RecentThreadSwitcher.logic.ts,apps/web/src/components/RecentThreadSwitcher.tsx,apps/web/src/components/AppSidebarLayout.tsx):opens.openedAt/lastVisitedAt/updatedAtfallback) and ignores archived, deleted, and delegated-under-parent threads.Ctrl+Tabreleased before 140 ms): jumps immediately to the previously opened thread with no HUD flash.Ctrl: reveals a centered frosted-glass (dropdown-glass) HUD listing up to 8 recent threads with project favicon, thread title, project title, and environment-scoped provider/model logo (ProviderInstanceIcon, with multi-instance badge support when applicable). SupportsTab/Shift+Tab, arrow keys, mouse hover/click,Enterto commit,Escape/ window blur to cancel, and releasingCtrlto switch.threadShortcutContextfromSidebar.logicand only derives provider entries while the overlay is visible.docs/user/keybindings.md): documentsthread.recentNext/thread.recentPreviousunder Commands with special behavior.Scope
Single focused enhancement adding
Ctrl+Tab/Ctrl+Shift+TabMRU thread switching across contracts, shared default keybindings, web switcher UI, translations, tests, and keybinding docs. (Note: this is a new feature contribution rather than a bug fix; happy to move to an Ideas discussion if preferred perCONTRIBUTING.md.)Verification
vp run check:changed&vp run i18n:check):vp format— pass (23 files)vp lint— pass (0 warnings, 0 errors across 206 rules)vp knip— passvp typecheck— pass across 40 packagesvp test— pass across 8 files / 104 tests, including:RecentThreadSwitcher.logic.test.ts(6 unit tests covering MRU deduplication, ordering fallback, next/previous start indices, cyclic stepping, modifier-release handling, and timestamp resolution)RecentThreadSwitcher.browser.test.tsx(3 Chromium browser tests verifying quickCtrl+Tabtoggle without HUD flash, hold-to-reveal HUD with Claude/Codex/Antigravity provider logos and commit onCtrlrelease, and immediate reveal on secondTab+Escapecancel)keybindings.test.ts(verifyingctrl+tab/ctrl+shift+tabresolution on desktop outside terminals, and non-matching on web or focused terminals)vp react compiler— pass (6 files)vp run i18n:check— pass (all catalogs match source)Ctrl+Tabtoggles between the two most recent threads with no HUD flash.Ctrl+Tabreveals the glass HUD in both dark and light themes with aligned provider logos (Cursor, Claude, Codex, Antigravity), cycles forward/backward onTab/Shift+Tab, and navigates onCtrlrelease.Thread: Next Recent(⌃ Tab) andThread: Previous Recent(⌃ ⇧ Tab) withWhen: isDesktop && !terminalFocus.Demo & Screenshots
Quick toggle & hold-to-cycle interaction
Glass switcher HUD (Dark mode)
Glass switcher HUD (Light mode)
Settings → Keybindings
Written with Gemini 4 Neon in T3 Code (Antigravity harness).