Skip to content

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

Open

Description

@Ernest0-Production

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. On macOS (desktop app or web), open a thread with at least one thread in history to go Forward to (or Back to).
  2. Open a code or diff pane with unwrapped long lines, scrolled all the way to the right.
  3. With the pointer over that pane, start a two-finger trackpad swipe to the right (nothing to scroll, so the Forward indicator appears).
  4. Without lifting the fingers, move left: the code scrolls left.
  5. Move right again past the swipe distance and lift.

The mirror also reproduces: pane scrolled to the left edge, start left, reverse right (code scrolls), come back left.

Expected behavior

Once the pane actually scrolls horizontally, the rest of that gesture belongs to the pane, as in a browser. The thread stays.

A swipe that starts at the pane's edge and never scrolls it should still go Back/Forward (as intended in #28160).

Actual behavior

The code scrolls, and the thread also switches when the fingers lift.

HistorySwipeNavigation (apps/web/src/components/HistorySwipeNavigation.tsx) decides once, in lockSwipeAxis after the first SWIPE_AXIS_LOCK_DISTANCE (8 px), whether a horizontal scroller under the pointer can scroll in the first direction (canScrollHorizontally). If it cannot, the gesture becomes tracking and is never re-checked. The window wheel listener is passive, so the reversed movement still scrolls the pane natively while the same gesture keeps accumulating distance toward the 120 px trigger.

This is the case #28091 left open: it only checks at the start of the gesture.

Impact

Minor bug or occasional failure

Version or commit

main @ 2c7bfce

Environment

macOS, built-in trackpad, desktop app and web (Chromium).

Logs or stack traces

N/A

Workaround

Lift the fingers before reversing direction.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions