[Bug]: Slightly diagonal vertical trackpad scrolling triggers back/forward navigation (axis locks after 8px, deltaY ignored)#30160

opened8d agobySsvetch

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. Run the desktop app on Linux (GNOME Wayland, libinput touchpad, natural scrolling on).
  2. Open any thread that has back history.
  3. Scroll the chat vertically with two fingers, but start the motion slightly diagonally. Your fingers should drift a little sideways in the first few pixels, which happens naturally.
  4. Keep scrolling vertically for a while.

Expected behavior

A mostly vertical scroll scrolls the content and never navigates. Back/forward navigation should need a clearly horizontal swipe.

Actual behavior

The app frequently navigates back (or forward) in the middle of normal vertical scrolling. On Linux, this makes the swipe gesture fire on most longer scrolls.

Cause, from apps/web/src/components/HistorySwipeNavigation.tsx (main @ cefb544):

  1. The axis locks after only 8px (SWIPE_AXIS_LOCK_DISTANCE = 8), and lockSwipeAxis only checks |sumX| > |sumY|. A barely diagonal start (e.g. 5px x / 3px y) is enough to enter tracking.
  2. Once tracking, deltaY is ignored. Only deltaX feeds gesture.distance, so horizontal drift during a scroll that is 90% vertical still adds up to SWIPE_TRIGGER_DISTANCE (120px). Vertical movement never cancels the gesture.
  3. Momentum fires it as well. isMomentumTail calls release(), which navigates as soon as the distance has crossed the threshold.

Suggested fix:

  • Lock the axis only on clear horizontal intent, e.g. |sumX| > 2 * |sumY| after ~20–30px.
  • Track the cumulative |deltaY| while tracking, and cancel (ignored) once vertical movement becomes significant compared with horizontal.
  • Optionally, raise the trigger distance, and/or add a setting to turn off swipe navigation. #28023 asked for that setting and was closed, but no setting exists on main.

Related: #28160 covers the scroll-boundary case in horizontally scrollable panes. This report is about plain vertical scrolling over non-scrollable-x content.

Impact

Major degradation or frequent failure

Version or commit

0.1.7-nightly.20261102.4093 (component unchanged on main @ cefb544)

Environment

Linux 7.0, GNOME on Wayland, ELAN06FA touchpad (libinput), natural scrolling enabled, AppImage desktop build

Workaround

None in-app. As a local workaround I am patching the bundled HistorySwipeNavigation with a stricter axis lock (2.5× ratio after 30px), cancellation on vertical movement and a 250px threshold.

Synced from GitHub

Same here on Ubuntu 24.04 (GNOME Wayland, libinput touchpad): ordinary vertical scrolls through a long thread navigate back mid-scroll.

The axis-lock fix described above would cut most of the false triggers. A setting to turn the gesture off would settle it for anyone who goes back and forth with the keyboard or the sidebar. #28023 asked for that setting and was closed as completed, but I can't find the setting in the app or in the code, so I'm asking for it here.

Synced from GitHub

Same bug here on macOS, so it's not only Linux.

T3 Code desktop 0.1.9-nightly.20261110.4452, macOS 27.2, built-in trackpad.

Normal two-finger scrolling through a long thread or a long diff often sends me back to the previous thread. Since it just goes back in history, I end up on whatever I opened before, like a finished thread or a subagent. There's also a short delay before the jump, so by the time it happens it's hard to tell the scroll caused it.

Going forward brings me back, but it happens a lot. A setting to turn off swipe navigation would help too.