fix(mobile): add tap threshold to terminal touch handler

touchmove fires on any 1px finger drift, marking didScroll=true and
skipping the tap handler (which refocuses terminal/CJK input). On
iPad's large touch surface and phones with imprecise taps, this makes
terminal tap unreliable — cjkActive gets stuck true, blocking all
input (CJK and paste).

Add 8px TAP_THRESHOLD: finger movement under 8px is still a tap.
Also add touch-action:none on .touch-device .terminal-container
so the browser doesn't consume touch events before our JS handler.
This commit is contained in:
Teigen
2026-06-17 23:40:21 +08:00
parent 47359e4002
commit b1c4330680
3 changed files with 35 additions and 10 deletions
+10 -2
View File
@@ -996,6 +996,12 @@ body {
display: none !important;
}
/* Redraw terminal header button: hidden by default (opt-in via App Settings →
Display → "Header Displays"). Pure client-side toggle. */
.btn-redraw-terminal--hidden {
display: none !important;
}
.btn-icon-header.btn-settings {
width: 30px;
height: 30px;
@@ -2229,8 +2235,10 @@ body.solo-mode .btn-lifecycle-log {
background: transparent !important;
}
/* Touch devices: JS touch handler owns scroll/tap — prevent browser
from consuming touch events before touchmove preventDefault fires. */
/* Touch devices: prevent browser from claiming the touch gesture before
our JS touchmove handler fires. Without this, the browser starts native
scrolling during the first few px of finger travel and ignores our
subsequent preventDefault() — breaking custom terminal scroll. */
.touch-device .terminal-container,
.touch-device .terminal-container .xterm,
.touch-device .terminal-container .xterm-viewport,