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
This commit is contained in:
Samuel Lee
2026-04-11 11:01:56 -07:00
parent 0b2ec74ee5
commit f206485f0a
+7 -5
View File
@@ -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;