2
0
Fork 0

fix: forward terminal taps to mouse-tracking apps #25

Merged
aleksei merged 1 commit from fix/mobile-terminal-taps into main 2026-11-03 22:20:46 +00:00
Owner

Cause

The manual-keyboard fix installed a capture-phase mousedown handler on the terminal that called both preventDefault() and stopPropagation(). xterm uses that mousedown for two things:

  • focusing its textarea;
  • sending the mouse press/release report when the application enables mouse tracking.

Stopping propagation prevented the second as well, so TUI buttons never received a click.

Fix

The handler now:

  • still calls preventDefault() on coarse pointers, so the browser does not move focus;
  • no longer calls stopPropagation(), so xterm receives the mousedown and sends the SGR/X10 report;
  • sets a 400 ms guard that blurs only the focus xterm tries to take from that tap.

The keyboard remains manual, but taps reach mouse-tracking applications.

Verification

  • npm run build
  • npm run typecheck
  • dprint check
  • git diff --check
  • Chromium and WebKit mobile harness with CSI ? 1000 h + CSI ? 1006 h:
    • tapping the terminal sent press and release reports:
      • Chromium \x1b[<0;25;17M / \x1b[<0;25;17m;
      • WebKit \x1b[<0;24;17M / \x1b[<0;24;17m;
    • document.activeElement stayed BODY, so the keyboard did not open.

The portal was not rebuilt or restarted.

## Cause The manual-keyboard fix installed a capture-phase `mousedown` handler on the terminal that called both `preventDefault()` and `stopPropagation()`. xterm uses that mousedown for two things: - focusing its textarea; - sending the mouse press/release report when the application enables mouse tracking. Stopping propagation prevented the second as well, so TUI buttons never received a click. ## Fix The handler now: - still calls `preventDefault()` on coarse pointers, so the browser does not move focus; - no longer calls `stopPropagation()`, so xterm receives the mousedown and sends the SGR/X10 report; - sets a 400 ms guard that blurs only the focus xterm tries to take from that tap. The keyboard remains manual, but taps reach mouse-tracking applications. ## Verification - `npm run build` - `npm run typecheck` - `dprint check` - `git diff --check` - Chromium and WebKit mobile harness with `CSI ? 1000 h` + `CSI ? 1006 h`: - tapping the terminal sent press and release reports: - Chromium `\x1b[<0;25;17M` / `\x1b[<0;25;17m`; - WebKit `\x1b[<0;24;17M` / `\x1b[<0;24;17m`; - `document.activeElement` stayed `BODY`, so the keyboard did not open. The portal was not rebuilt or restarted.
aleksei deleted branch fix/mobile-terminal-taps 2026-11-03 22:20:46 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
zoo/mux-portal!25
No description provided.