fix(mobile): route terminal taps without opening the keyboard - #186
fix(mobile): route terminal taps without opening the keyboard#186Lint111 wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refines mobile terminal touch handling so taps and drags behave predictably without spuriously opening the software keyboard, while still forwarding TUI-owned interactions (mouse/touch gestures) to the underlying CLI when appropriate.
Changes:
- Adds a mobile tap classifier to distinguish prompt/input rows from TUI content (readbacks, menus, Claude “Working/background” rows) and from local scrollback.
- Routes content taps as SGR mouse reports while explicitly preventing keyboard focus; keeps prompt taps focus-only on the first tap to avoid accidental activation.
- Extends mobile touch-drag scrolling to forward as SGR wheel events for verified Claude versions, while preserving local xterm scrolling for Codex/others; adds targeted unit + mobile regressions.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/web/public/terminal-ui.js | Implements tap classification + focus/blur routing; forwards selected touch scroll gestures as SGR wheel for verified Claude. |
| test/terminal-touch-tap.test.ts | Adds unit coverage for tap classification, focus-only behavior, readback collapse, and touch scroll forwarding gates. |
| test/mobile/keyboard.test.ts | Adds browser regressions ensuring content taps don’t focus the hidden textarea, prompt taps do, and Claude drags route to transcript scrolling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Ark0N
commented
Aug 5, 2026
Hi Lior, closing this one as part of a cleanup of the seventeen PRs currently open from you. The full explanation is in #173, and I would rather you read that one than this note, because it is the honest version and it is not a dismissal of your work. The short form: sixteen PRs opened in a single day, roughly 42,000 added lines in total, landing mostly on the same few files (nine touch Going forward, please keep no more than three open PRs at a time, each one a single behavior change that stands on its own, with a test that fails on master and passes with the fix. #214 and #215, merged today, are good models. If this particular change fixes something that genuinely annoys you in daily use, it is a good candidate to be the first one you reopen on its own, rebased on current master. I will review it properly. Thanks for the effort you put in, and sorry to close it this way. |
Summary
Make terminal touches behave predictably on mobile without opening the software keyboard for TUI-owned content.
This PR is the focused tap/gesture slice extracted from the larger mobile-experience branch. It is intentionally limited to
terminal-ui.jsand its unit/browser regressions.Behavior
Working/ background-agent status rows as TUI content.Audit Fixes
The original classifier relied too heavily on visible prompt glyphs. During promptless Claude redraws, a live row could be classified as content,
touchstartwould suppress browser focus, and the mobile keyboard became unreachable.The final commit gives precedence to known menus and working rows, then treats the live cursor and a four-row lower-screen fallback band as input. The browser regression verifies both required outcomes:
document.activeElementThe split also removes a hidden dependency on the separate history-anchor feature by using the existing local-scroll operations directly.
Commit Structure
fix(mobile): keep keyboard focus taps non-activatingfix(mobile): route terminal content taps to the CLIfix(mobile): route Claude terminal gesturesfix(mobile): keep promptless terminal input focusableVerification
npx vitest run --config config/vitest.config.ts test/terminal-touch-tap.test.tsnpx vitest run --config test/mobile/vitest.config.ts test/mobile/keyboard.test.ts -t "focuses the live Claude cursor|prevents Claude subagent status taps|focuses the terminal helper textarea when the visible prompt is tapped"npm run check:frontend-syntaxnpm run check:public-assetsnpx prettier --check test/mobile/keyboard.test.ts test/terminal-touch-tap.test.tsnpm run buildNon-Goals