From f206485f0a0747281c407b6607c372aa03f14dae Mon Sep 17 00:00:00 2001 From: Samuel Lee Date: Sat, 11 Apr 2026 11:01:56 -0700 Subject: [PATCH] Fix touch scrolling on iOS and iPadOS devices The touch scroll handler was only enabled for Android devices, leaving iOS/iPad users unable to scroll through terminal history. Changes: - Extend UA detection to include iPhone, iPad, and iPod - Add iPadOS 13+ detection (reports as MacIntel with touch points) - Rename function to initMobileTerminalScroll for clarity Fixes #3 --- muxplex/frontend/terminal.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/muxplex/frontend/terminal.js b/muxplex/frontend/terminal.js index e106336..f134bb4 100644 --- a/muxplex/frontend/terminal.js +++ b/muxplex/frontend/terminal.js @@ -534,13 +534,15 @@ function setTerminalFontSize(size) { window._setTerminalFontSize = setTerminalFontSize; // --------------------------------------------------------------------------- -// Android touch scroll — rAF-batched WheelEvent dispatch -// Android batches touchmove events irregularly; dispatching one WheelEvent +// Mobile touch scroll — rAF-batched WheelEvent dispatch +// Mobile devices batch touchmove events irregularly; dispatching one WheelEvent // per frame (via requestAnimationFrame) smooths over burst delivery. -// UA-gated: iOS and macOS are unaffected (they use mouse wheel natively). +// Applies to Android, iOS, and iPadOS touch devices. // --------------------------------------------------------------------------- -;(function initAndroidTerminalScroll() { - if (!/Android/i.test(navigator.userAgent)) return; +;(function initMobileTerminalScroll() { + var isTouchDevice = /Android|iPhone|iPad|iPod/i.test(navigator.userAgent) || + (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1); + if (!isTouchDevice) return; var container = document.getElementById('terminal-container'); if (!container) return;