Repository navigation
fix(desktop): macOS swipe Back/Forward moves the focused Browser tab - #33321
juliusmarminge wants to merge 8 commits into
Conversation
…ser tab These tests reproduce #33307: when a Browser-tab preview guest of the window holds keyboard focus, a macOS swipe (how Logi Options+ delivers mouse Back/Forward) should navigate that guest's history, but the handler always navigates the app's own webContents history. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mouse drivers such as Logi Options+ deliver thumb Back/Forward as a BrowserWindow swipe, and the handler always navigated the app's own history even while the user was in the Browser tab. The swipe now goes to the window's preview guest that holds keyboard focus, using the preview manager's existing focus rule, and falls back to the app history otherwise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… loses focus Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — macOS Back/Forward swipes now navigate the focused Browser tab, with app history retained as the fallback. The change reuses existing focus detection and remains limited to user-triggered navigation in the current window. Notes:
No code changes detected at You can add or adjust custom eligibility rules. Learn more. |
… test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Dismissing prior approval to re-evaluate 6540c62
|
The automated pipeline stopped on this pull request and will not merge it: the proof has no capture anyone can open:
It stays open for a person to finish or close. |
Problem
On macOS, mouse drivers such as Logi Options+ send thumb Back/Forward as a window
swipegesture, not as mouse buttons 4/5. The desktop app'sswipehandler always moved the app's own history. When the user clicked into the right-panel Browser tab and pressed Back, the app went back to the previous thread or route and the Browser tab stayed where it was. A three-finger trackpad swipe takes the same path.Reproduced on main
2b65ffb641with a unit test of the handler (a real macOSswipecannot be produced on Linux). A Browser tab guest that holds keyboard focus is attached to the window, then the test swipes left and right. The app history moved back once and forward once ([1, 1]), and the Browser tab did not move ([0, 0]).Change
swipehandler inapps/desktop/src/window/DesktopWindow.tsnow looks for a webview guest of this window that holds keyboard focus. If it finds one, the swipe moves that guest's history and leaves the app history alone. Otherwise the app history moves as before.isFocused() && focusedFrame !== null). Every guest of a focused window reportsisFocused(), sofocusedFramedecides, and it goes null once focus returns to the app. The helper moves to module scope inapps/desktop/src/preview/Manager.tsso both callers share it.Scope and approval
Fixes #33307
Triaged via the automated issue flow. Mouse buttons 3/4 over Browser tab content are a separate path, covered by https://git.cafe/pingdotgg/t3code/pulls/33276.
Verification
Checked on head
e303ce0cb0(main934c7f8d8emerged in).vp test run apps/desktop/src/window/DesktopWindow.test.ts: 27/27 pass. The swipe testDesktopWindow > maps macOS horizontal swipes to the focused Browser tab or the app historyfails on main with:focusedFrameclears, wherecanGoBack/canGoForwardstill apply. With the focus check replaced bytrue, the last assertion fails (browserTab: [2, 2], expected[1, 1]).<webview>guests, driven bysendInputEventclicks. Every guest reportedisFocused(). Only the clicked guest had a non-nullfocusedFrame. It went back tonullafter any of these: a click on a host input, a click on the empty host body, focusing the host from script, hiding the webview, orblur().vp run check:changedone303ce0cb0: pass (format, lint, knip, typecheck of 2 packages, tests in 2 files).e303ce0cb0: no code defects found by either reviewer.holdsKeyboardFocushelper (guest editing shortcuts, forwarded app shortcuts such as Ctrl+L and F6, several guests and focus returning to the app, agent key input into an unfocused guest, native popup editing). These are not captured yet.swipeevent exists only on macOS. Real Logi Options+ or trackpad gestures, and macOS Chromium clearing a guest'sfocusedFrameafter focus returns to the app, were not exercised on a Mac. The acceptance sequence there: click into the Browser tab, swipe back and forward (the Browser tab moves, the thread stays); click the composer, swipe again (the app history moves).AI-assisted; verified with the tests and tools listed above.