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
fix(web): trackpad swipe no longer switches threads after scrolling a code pane - #39100
On macOS, a two-finger swipe that starts at the edge of a code or diff pane locks into thread navigation; reversing direction then scrolls the pane, and the thread still switches when the fingers lift. Fixes#39099.
Change
HistorySwipeNavigation checked canScrollHorizontally only once, in lockSwipeAxis after the first 8 px. A gesture in tracking was never re-checked, and the passive wheel listener let the pane scroll natively while distance kept accumulating.
apps/web/src/components/HistorySwipeNavigation.tsx: in the tracking branch, a horizontal wheel event that a scroller on its composed path can absorb now ignores the rest of the gesture and hides the indicator, the same way the vertical-scroll bailout does.
Bug fix for #39099, the case #28091 left open. One problem. Mobile has no history swipe (React Native navigation), so only web is affected; desktop wraps web. No contract, settings, or keybinding surface.
Verification
Found from the user's repro (right, left, right over long unwrapped code), then traced to the one-time check in lockSwipeAxis.
New HistorySwipeNavigation.browser.test.tsx rows emulate native scrolling on the pane and reverse direction at the right edge and the left edge. Both fail on main (navigateHistory called 1 time) and pass with the fix. The existing "swiping back at a shadow-root scroller's left edge navigates" row still passes.
vp test run src/components/HistorySwipeNavigation.browser.test.tsx src/components/HistorySwipeNavigation.test.ts: 18 passed.
vp run check:changed: all pass.
Not checked on a physical trackpad in the running app; synthetic wheel events cannot drive Chromium's native trackpad scrolling, so no before/after capture.
… code pane
A two-finger swipe that started at the edge of a horizontal scroller locked
into thread navigation after its first 8px and was never re-checked, so
reversing direction scrolled the pane while the same gesture still switched
threads on release.
While a swipe is tracked, a horizontal movement that a scroller under the
pointer can absorb now ends history handling for the rest of the gesture.
A swipe that starts at the edge and never scrolls the pane still navigates.
Made-with: claudeAgent/claude-opus-5-5
Reviewing files that changed from the base of the PR and between cc3ffa5 and e7187c8.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
During a tracked swipe, onWheel now stops handling the gesture when horizontal wheel movement occurs over a horizontally scrollable element. Browser tests cover direction reversal at both edges of an overflowing scroller.
Changes: Tracked swipe handling
Layer / File(s)
Summary
Tracking guard and edge tests apps/web/src/components/HistorySwipeNavigation.tsx, apps/web/src/components/HistorySwipeNavigation.browser.test.tsx
The tracking-phase guard now checks for nonzero horizontal movement over a horizontally scrollable element. Tests simulate scrolling at either edge and verify that reversing direction does not navigate history.
Issue 33888 also concerns horizontal scrolling in a wide table or diff pane triggering history navigation. This change addresses the scroller case described there, but not horizontal wheel input when no scrollable element is present.
Possibly related PRs
pingdotgg/t3code#28091: Adds the composed-path scrollability check that this change applies during tracking.
pingdotgg/t3code#28475: Addresses history navigation triggered by horizontal scrolling in diff or file panes using a different mechanism.
Suggested labels:bugfix
Suggested reviewers:juliusmarminge, macroscopeapp
Merge Risk: Minimal · previous review 4687e
Swiping over a horizontally scrolling code or diff pane should no longer switch threads once the pane has started scrolling. Back/Forward from an unscrolled edge is meant to be preserved. The change is small and web-only, and merge risk is minimal.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix(web): trackpad swipe no longer switches threads after scrolling a code pane" matches the main change. The PR stops the history swipe gesture once a horizontal wheel event is absorbed by…
Description check
The description follows the repository template. It has Problem, Change, Scope, and Verification sections, and each section gives specific content. The Problem section states the expected behavior and…
Linked Issues check
Directly linked issue #39099 has two coding requirements. (1) Once a horizontal pane scrolls during a gesture, the rest of that gesture must not switch threads. (2) A swipe that starts at the pane edg…
Out of Scope Changes check
The reviewed whole-PR change set has two files. apps/web/src/components/HistorySwipeNavigation.tsx has a 4-line functional change (+3/-1) that is directly tied to #39099. apps/web/src/components/Histo…
Full details: Title check
Explanation
The title "fix(web): trackpad swipe no longer switches threads after scrolling a code pane" matches the main change. The PR stops the history swipe gesture once a horizontal wheel event is absorbed by a scroller on its composed path, so a pane scroll no longer triggers thread navigation on release. The title uses conventional commit format and plain language, and it names the affected platform area (web) and the symptom.
Full details: Description check
Explanation
The description follows the repository template. It has Problem, Change, Scope, and Verification sections, and each section gives specific content. The Problem section states the expected behavior and reproduction context (macOS two-finger swipe at a code or diff pane edge). The Change section explains the root cause (the one-time canScrollHorizontally check in lockSwipeAxis) and the fix. The Scope section links issue #39099, explains why no issue is needed beyond that link, and states that only web is affected. The Verification section lists the focused tests, their before/after results on main, and what was not checked. The description also notes that no before/after screenshots or recording were captured, and it explains why (synthetic events cannot drive native trackpad scrolling). The template asks for a visual capture for UI changes, so that omission is a minor gap. The template also asks for the model and harness used; the author included a 'Made-with' line. The description is mostly complete.
Full details: Linked Issues check
Explanation
Directly linked issue #39099 has two coding requirements. (1) Once a horizontal pane scrolls during a gesture, the rest of that gesture must not switch threads. (2) A swipe that starts at the pane edge and never scrolls the pane must still navigate Back/Forward (#28160). The reviewed diff for apps/web/src/components/HistorySwipeNavigation.tsx adds one condition to the tracking-branch onWheel handler. A nonzero horizontal wheel event now sets the gesture to 'ignored' and hides the indicator when canScrollHorizontally(event.composedPath(), event.deltaX) is true. This covers requirement (1), and it reuses the existing bailout path. Requirement (2) is preserved because the bailout runs only when a scroller on the composed path can absorb the event. The PR description and the raw summary also state that new browser test rows for both pane edges were added, that the existing shadow-root left-edge row still passes, and that the test run reports 18 passing. I did not read the test file, so those test results are reported by the author and not independently verified. The code change itself matches the issue's root cause, which is the one-time check in lockSwipeAxis. The issue's non-coding repro steps are not assessed.
Full details: Out of Scope Changes check
Explanation
The reviewed whole-PR change set has two files. apps/web/src/components/HistorySwipeNavigation.tsx has a 4-line functional change (+3/-1) that is directly tied to #39099. apps/web/src/components/HistorySwipeNavigation.browser.test.tsx has added regression rows for the reversal case at both pane edges (per the raw summary), which support that same objective. No contract, settings, keybinding, mobile, or unrelated code changes are described or visible in the reviewed diff. Test rows are supporting changes for the fix and are not out of scope.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
The automated pipeline stopped on this pull request and will not merge it:
these checks fail on cc3ffa5, also when run again: Check, Build and Typecheck, Test, and the rework changed nothing:
Nothing changed: all three failed checks were caused by the CI runner, not by the code. Build and Typecheck and Test timed out after 5 minutes in the setup step 'Finish installing browser secret helper build libraries' (an apt install), before any build or test ran. Check failed only because those two jobs failed, and its log shows test_web and test_server passed. An unrelated pull request (branch perf/turn-start-read, run 44523896187) failed at the same time in the same step of the same two jobs, so this is runner apt trouble that this branch cannot fix. Head is unchanged at cc3ffa5. The fix itself stands: once a history swipe is tracking, a horizontal wheel event that the pane under the pointer can scroll in its direction cancels the swipe, so a reversal at a scroller's edge can no longer bring the distance down and then let a later flick switch threads. Earlier local runs showed both new test rows fail on main and pass with the fix, and vp run check:changed passed.
Hi @juliusmarminge ! Could you please double-check since the CI runners have already been restored?
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:XS0-9 changed lines (additions + deletions).takeover:blockedTakeover blocked; reason in the PR bodyvouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On macOS, a two-finger swipe that starts at the edge of a code or diff pane locks into thread navigation; reversing direction then scrolls the pane, and the thread still switches when the fingers lift. Fixes #39099.
Change
HistorySwipeNavigationcheckedcanScrollHorizontallyonly once, inlockSwipeAxisafter the first 8 px. A gesture intrackingwas never re-checked, and the passivewheellistener let the pane scroll natively while distance kept accumulating.apps/web/src/components/HistorySwipeNavigation.tsx: in thetrackingbranch, a horizontal wheel event that a scroller on its composed path can absorb now ignores the rest of the gesture and hides the indicator, the same way the vertical-scroll bailout does.Scope
Bug fix for #39099, the case #28091 left open. One problem. Mobile has no history swipe (React Native navigation), so only web is affected; desktop wraps web. No contract, settings, or keybinding surface.
Verification
Found from the user's repro (right, left, right over long unwrapped code), then traced to the one-time check in
lockSwipeAxis.HistorySwipeNavigation.browser.test.tsxrows emulate native scrolling on the pane and reverse direction at the right edge and the left edge. Both fail onmain(navigateHistorycalled 1 time) and pass with the fix. The existing "swiping back at a shadow-root scroller's left edge navigates" row still passes.vp test run src/components/HistorySwipeNavigation.browser.test.tsx src/components/HistorySwipeNavigation.test.ts: 18 passed.vp run check:changed: all pass.Made-with: claudeAgent/claude-opus-5-5