Commit Graph
1 Commits
Author SHA1 Message Date
yetone 187f3e2727 usage: a swipe across the Requests table is never written back by its scrollbar's echo (Pluviophile)
Pluviophile on Discord (a phone, magpie's web page and the installed
PWA): swiping the Usage › Requests table left or right trembles and
sticks (左右滑动震颤, 粘滞卡顿).

The cause: the table (#ledWrap) and the scrollbar kept at the window's
foot (#ledHScroll, #799) followed each other both ways, each scroll
handler copying its scrollLeft to the other when they differed. The
scroll a copy sets off is told a frame later in WebKit, and on a phone
the finger (the UI side's own scrolling) has moved the table on by
then, so the bar's echo saw bar != table and wrote the table back to
where it was a frame ago, every other frame of a swipe.

Now each copy records the value it set (ledFollow), and that box's next
scroll at that value is its echo and is passed on to nobody
(ledFollowed). A scroll of the reader's on either box still moves the
other, in both directions; ledHScroll's own copy at a redraw goes
through ledFollow too.

Measured with Playwright at an iPhone 13 profile (390x664, touch, dpr
3), the table moved 2.5px every 7ms off the frame, as a phone's own
scrolling moves it, 60 frames:
- WebKit before: 44 writes of the table by the page, the table stood
  still in 29 of 59 frames (5,5,15,15,22,22,...).
- WebKit after: 0 writes, 0 frames standing still.
- Chromium before and after: 0 writes, 0 still; a real touch gesture
  (CDP Input.synthesizeScrollGesture, touch) also showed none. The
  report is WebKit's (iOS), which Chromium doesn't reproduce.

New test, internal/gui/tests/ledger-swipe.test.cjs: the table swiped
off the frame is never written back nor stands still, and the bar
follows; the bar dragged off the frame is never written back, and the
table follows. en and zh, Chromium and WebKit, iPhone 13 profile.

Broken by hand: page.js at its base (d8501848a) turns the new test red
in WebKit, en and zh (the table written back, values in pairs); green
in Chromium, which never had it.

Run at the pushed head, on mote, through mote-run:
- at f5c709ddc (this commit rebased on origin/main 3f1f1882a): node
  --check page.js; ledger-swipe, ledger-hscroll, ledger-hscroll-foot,
  usage-ledger-fit, usage-ledger-detail, phone-web, usage-phone-head:
  55 of 55 pass, Chromium and WebKit.
- before the rebase (base d8501848a): the 33 ledger-*, usage-ledger-*,
  phone-*, mobile-web, usage-phone-head, plugin-page* and i18n-keys
  files, 527 of 547 pass. The 20 reds (mobile-web "magpie web on
  phones", phone-connect-menu 420 "the address clicked from the
  page's top", usage-ledger "newest live route needs no
  return-to-live button") fail the same 20 with page.js at d8501848a
  and are filed: #3952, #5013, #4706, #4707, #3104, #4078, #5048.

Not tried: a real phone (iOS Safari, an iOS PWA, Android Chrome); the
model is WebKit on macOS with the table moved between frames. Desktop
is covered by ledger-hscroll (600px, bar moves the table and the table
the bar, both engines), which passes unchanged.
2026-11-03 19:39:27 +08:00