mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-09 16:59:43 +02:00
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:
@@ -162,6 +162,10 @@ const CjkInput = (() => {
|
||||
if (!_textarea.classList.contains('cjk-input-visible')) {
|
||||
window.cjkActive = false;
|
||||
}
|
||||
// Reset composing state — some IMEs fire compositionstart without a
|
||||
// matching compositionend, leaving _composing stuck true and blocking
|
||||
// all subsequent input events.
|
||||
_composing = false;
|
||||
};
|
||||
_textarea.addEventListener('mousedown', _listeners.mousedown);
|
||||
_textarea.addEventListener('focus', _listeners.focus);
|
||||
@@ -214,8 +218,10 @@ const CjkInput = (() => {
|
||||
return;
|
||||
}
|
||||
|
||||
// Below: only when NOT composing (composing keystrokes belong to IME)
|
||||
if (_composing) return;
|
||||
// Below: only when NOT composing (composing keystrokes belong to IME).
|
||||
// Also check isComposing/keyCode 229 — the first keydown of a CJK
|
||||
// sequence arrives BEFORE compositionstart, so _composing is still false.
|
||||
if (_composing || e.isComposing || e.keyCode === 229) return;
|
||||
|
||||
// Backspace: forward to PTY when no real text in textarea
|
||||
if (e.key === 'Backspace' && _isEffectivelyEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user