Skip to content

fix(web): trackpad swipe no longer switches threads after scrolling a code pane - #39100

Open
Ernest0-Production wants to merge 3 commits into
pingdotgg:mainfrom
Ernest0-Production:fix/abort-swipe-after-scroll
Open

Ernest0-Production wants to merge 3 commits into
pingdotgg:mainfrom
Ernest0-Production:fix/abort-swipe-after-scroll

Conversation

@Ernest0-Production

Copy link
Copy Markdown
Contributor

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

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.

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.

  • 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.

Made-with: claudeAgent/claude-opus-5-5

… 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
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 19, 2026
@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 19, 2026
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

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.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related issues

  • 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

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 Passed 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 Passed 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
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 2c7bfce and 4687e13.

Files selected for processing: 2

  • apps/web/src/components/HistorySwipeNavigation.browser.test.tsx
  • apps/web/src/components/HistorySwipeNavigation.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member

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.

It stays open for a person to finish or close.

@juliusmarminge juliusmarminge added takeover:blocked Takeover blocked; reason in the PR body and removed takeover:in-progress A takeover lead is working on this PR labels Nov 19, 2026
@Ernest0-Production

Copy link
Copy Markdown
Contributor Author

Hi @juliusmarminge ! Could you please double-check since the CI runners have already been restored?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). takeover:blocked Takeover blocked; reason in the PR body vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Trackpad swipe still switches threads after the gesture scrolls a code pane

2 participants