Repository navigation
feat: two-finger trackpad swipes go back and forward - #26991
ipanasenko wants to merge 2 commits into
Conversation
Swiping left or right with two fingers on a Mac trackpad now moves through history like Chrome. On the web, the browser's own gesture is back: only vertical overscroll stays disabled. The desktop app draws a Chrome-style arrow that follows the fingers, fades the page, and navigates on release. It respects macOS "Swipe between pages". Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
ApprovabilityVerdict: Needs Human Approval Macroscope's review found this PR requires human approval — The change introduces default-enabled macOS trackpad history navigation and adds a line-level lint suppression. Both changes require human review under the configured requirements. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Expose the macOS swipe preference apps/desktop/src/ipc/channels.ts, apps/desktop/src/ipc/methods/window.ts, apps/desktop/src/ipc/DesktopIpcHandlers.ts, apps/desktop/src/preload.ts, packages/contracts/src/ipc.ts |
Adds a synchronous IPC channel and desktop bridge method. The method returns false outside macOS and checks the macOS swipe preference on macOS. |
Track and validate swipe gestures apps/web/src/lib/swipeNavigation.ts, apps/web/src/lib/swipeNavigation.test.ts |
Adds gesture state, threshold and coasting checks, and scroll-container claim detection. Tests cover gesture transitions, coasting, and LTR/RTL scroller behavior. |
Integrate gesture navigation apps/web/src/components/SwipeNavigation.tsx, apps/web/src/components/AppSidebarLayout.tsx, apps/web/src/index.css, docs/user/keybindings.md |
Mounts the navigation component in the macOS desktop app. The component tracks wheel gestures, displays progress feedback, and navigates history when a gesture commits. Updates overscroll styling and documents the trackpad behavior. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Feature
Sequence Diagram(s)
sequenceDiagram
participant AppSidebarLayout
participant SwipeNavigation
participant desktopBridge
participant DesktopIpcHandlers
participant getSwipeNavigationEnabled
participant Trackpad
participant BrowserHistory
AppSidebarLayout->>SwipeNavigation: Render on macOS desktop
SwipeNavigation->>desktopBridge: Read swipe-navigation setting
desktopBridge->>DesktopIpcHandlers: Send synchronous preference request
DesktopIpcHandlers->>getSwipeNavigationEnabled: Check macOS preference
getSwipeNavigationEnabled-->>SwipeNavigation: Return enabled state
Trackpad->>SwipeNavigation: Send wheel gesture
SwipeNavigation->>BrowserHistory: Navigate back or forward when committed
Possibly related PRs
- pingdotgg/t3code#25188: Adds macOS swipe handling for back and forward navigation using a different gesture mechanism.
- pingdotgg/t3code#21723: Adds macOS swipe handling for back and forward navigation using a different gesture mechanism.
Suggested reviewers: macroscopeapp, t3dotgg
Merge Risk: 
Minimal · up to 839e3
-
This adds macOS trackpad swipe navigation that follows the system "Swipe between pages" setting. No concrete merge-blocking issue remains. Native behavior in a real macOS window was not run here, so a quick manual check is still sensible.
Pre-merge checks: 
3 · 
1
-
Failed checks: 1 warning Passed checks: 3 passedFull details: Description check
-
Explanation
The description covers the problem, implementation, scope, and verification. However, the Scope and approval section states that the linked discussion has no maintainer approval, although the template requires explicit approval for this feature.
Resolution
Obtain explicit maintainer approval for the proposed direction and scope in the linked discussion, then update the Scope and approval section with the approval comment or link.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
Note 🤖 Written by Claude Opus 5.5 on behalf of Illia Closing in favor of #9779, which a maintainer took over on Oct 19 and which uses the same two-finger horizontal swipe on desktop. |
Hey guys!
I haven't tested this on Linux/Windows - feel free to take over this PR or just close.
But I use this gesture all the time and I really miss it in T3 Code 🙏
Note
🤖 Written by Claude Opus 5.5 on behalf of Illia
Problem
On a Mac trackpad, Chrome and Safari go back and forward with a two-finger horizontal swipe. T3 Code had no such gesture: Electron doesn't implement it in the desktop app, and the web build turned the browser's own gesture off with
overscroll-behavior: noneonhtml, body. History navigation was only reachable throughmod+[andmod+].Change
Web:
overscroll-behavior: nonebecomesoverscroll-behavior-y: none, so the browser's native swipe-back works again. Vertical overscroll stays off, which is what #2392 added the rule for.Desktop (macOS): a new
SwipeNavigationoverlay inAppSidebarLayoutdraws a Chrome-style arrow and calls the samewindow.history.back()/forward()asnavigation.back/navigation.forward.input-eventcarries only the event type. Chromium'sgestureScrollEnd, already bridged for the device viewer, arrives at lift, or only once macOS momentum stops, so a flick would navigate about a second late.swipeGestureCoastingrecognizes momentum (six non-increasing steps of at least 6px, decaying 4% to 30%) and navigates early. The constants come from 29 traced swipes on a MacBook trackpad, including reverse-to-cancel swipes, where it never fired. Slow releases with low-speed momentum still wait for scroll end.desktopBridge.getSwipeNavigationEnabled()readsAppleEnableSwipeNavigateWithScrolls, where unset means the macOS default (on). It is re-read on window focus.overscroll-behavior-xcontainment.docs/user/keybindings.mdmentions the swipe next tonavigation.back.Scope and approval
Proposed in discussion #18296, with no maintainer approval yet; I described this PR there. It reuses the existing history navigation and the existing trackpad scroll-end bridge.
Verification
Desktop (macOS):
Screen.Recording.2026-10-29.at.4.21.04.PM.mov
Screen.Recording.2026-10-29.at.4.22.06.PM.mov
apps/web/src/lib/swipeNavigation.test.ts(17 cases): dead zone and axis lock, threshold commit, reversal retracts without arming the other direction, momentum detection on traced sequences, and scroller ownership in LTR, RTL and contained cases.systemPreferences.getUserDefault(key, "string")returns""for the unsetAppleEnableSwipeNavigateWithScrolls, and"1"/"0"for set booleans.vp run check:changedpasses.Two-way door. Blast radius: navigation. On the web, horizontal swipes outside horizontal scrollers can now trigger the browser's own back and forward. On macOS desktop, a passive window
wheellistener runs a small state machine per event.Claude Opus 5.5 in T3 Code (Claude Code harness).