Files
terminal-lab/pxterm/fix_touch_css.cjs
2026-03-03 21:19:52 +08:00

14 lines
1.0 KiB
JavaScript

const fs = require('fs');
let code = fs.readFileSync('src/styles/main.css', 'utf8');
// The reason touchmove stops is because touch events on iOS are sometimes silently swallowed if touch-action is not correct.
// Actually, earlier you saw the logs: only `pointermove` is logging!! The `touchmove` ONLY LOGS ONCE!
// Safari 13+ on iOS stops emitting touchmove if it emits pointermove, UNLESS we call e.preventDefault() on the touchmove, but since we didn't get touchmove... Wait.
// Safari emits touchstart -> pointerdown -> touchmove (if not scrolling) / pointermove.
// Actually, the iOS browser decides it's doing a native scroll, so it cancels the `touchmove`. But wait, there was NO `touchcancel`!
// What if iOS is using `pointermove` instead of `touchmove` entirely for the rest of the gesture?
// YES! Pointer events are replacing Touch events in Safari for some logic!
// Our `touchmove` handler was the only one syncing the scroll:
// \`onTouchKeyboardTouchMove = (event: TouchEvent) => { ... }\`
// We IGNORED pointermove!