fix(terminal): enable touch-scroll in alternate buffer with mouse tracking#383
Merged
Conversation
…cking For providers with the native scrollInputPolicy (the default), touch swipes in alternate buffer + mouse-tracking mode formerly fell through to scrollLines, which is a no-op in xterm.js alternate buffers because they have no scrollback. Fix: when native policy is active and the terminal is in alternate buffer with mouse tracking on, dispatch synthetic WheelEvents directly to term.element. xterm.js translates these into mouse-wheel CSI sequences sent to the PTY, matching desktop wheel behavior. Includes position data (clientX/clientY) on synthetic events for accurate mouse tracking in TUIs with multiple scrollable regions. Tests cover: - Native policy wheel dispatch (upward and downward direction, multi-line swipes producing repeated events, correct deltaMode). - term.element == null fallback to scrollLines. - Fallback-to-cursor-keys policy sends cursor key sequences. - Normal buffer continues to call scrollLines as before.
danshapiro
pushed a commit
that referenced
this pull request
Jun 2, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
For providers with the native scrollInputPolicy (the default), touch swipes in alternate buffer + mouse-tracking mode formerly fell through to scrollLines, which is a no-op in xterm.js alternate buffers because they have no scrollback.
Changes
Implementation
Fixes
Tests
Fresheyes
Passed 4th review (3rd after fixes).