From 9035306e22d2749c6eceecdfa0c8e28859f67464 Mon Sep 17 00:00:00 2001 From: rays Date: Tue, 17 Nov 2026 01:39:34 +0000 Subject: [PATCH] A stuck scroll's report says where the drag began and who held it (#450) Three scroll_stuck reports (2026-11-11, 11-12, 11-16) show a reader that would not move with nothing wrong in what they record: no layer over it, nothing inert, no transform, overflow auto. They started on the text (p, a span in a pre, an image), not the left edge the swipe code cancels. The report now also says where the finger began (x), how many touchmove events the page saw during the drag (none would mean the browser kept the gesture, as a scroller inside the text can), whether the touch was cancelled, and how long since the reader was last slid across by a swipe, which is the one thing a swipe changes on it and a suspect for WebKit losing the scroller. The next report decides the fix. Co-Authored-By: Claude Opus 5.5 --- web/src/gestures.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/web/src/gestures.ts b/web/src/gestures.ts index 5275b9e..409d9e3 100644 --- a/web/src/gestures.ts +++ b/web/src/gestures.ts @@ -118,6 +118,7 @@ function beside(dx: number){ /// beside it with it. function slide(dx: number, ms = 160){ const d = $('#detail'); if(!d) return; + slidAt = Date.now(); dx = Math.round(dx); // whole pixels, or the seam between the reader and its neighbour blurs const w = d.clientWidth || 1, tr = ms ? `transform ${ms}ms ease-out, opacity ${ms}ms ease-out` : 'none'; d.style.transition = tr; @@ -205,7 +206,11 @@ document.addEventListener('touchcancel', () => { if(touch?.pane === 'list') pull /// way, after which it has not moved. Watched by where the finger is, not by what it landed on, /// so something lying over the reader is caught too, and named. Reported with what could hold it, /// since the cause of the one in #383 was never found. -let drag: {x: number, y: number, top: number, on: string} | null = null, shownAt = Date.now(); +// What #450's three reports could not say (#450): where the finger began, whether the page saw it +// move at all (none means the browser kept the drag for itself), whether the page cancelled the +// touch, and how long since the reader was last slid across, the one thing a swipe changes on it. +let drag: {x: number, y: number, top: number, on: string, moves: number, cancelled: boolean} | null = null, + shownAt = Date.now(), slidAt = 0; document.addEventListener('visibilitychange', () => { if(!document.hidden) shownAt = Date.now(); }); const named = (el: Element | null) => !el ? 'nothing' : el.id ? '#' + el.id : el.tagName.toLowerCase() + (typeof el.className === 'string' && el.className ? '.' + el.className.split(' ')[0] : ''); @@ -220,8 +225,11 @@ document.addEventListener('touchstart', ev => { if(ev.touches.length !== 1 || !d || !S.sel) return; const r = d.getBoundingClientRect(); if(t.clientX < r.left || t.clientX > r.right || t.clientY < r.top || t.clientY > r.bottom) return; - drag = {x: t.clientX, y: t.clientY, top: d.scrollTop, on: named(ev.target as Element)}; + drag = {x: t.clientX, y: t.clientY, top: d.scrollTop, on: named(ev.target as Element), moves: 0, cancelled: false}; + // After the swipe's own touchstart, which may cancel it, has run. + queueMicrotask(() => { if(drag) drag.cancelled = ev.defaultPrevented; }); }, {passive: true}); +document.addEventListener('touchmove', () => { if(drag) drag.moves++; }, {passive: true}); document.addEventListener('touchend', ev => { const d = $('#detail'), t = ev.changedTouches[0], g = drag; drag = null; @@ -235,5 +243,7 @@ document.addEventListener('touchend', ev => { `inert ${inert || 'none'}`, `dialog ${$('#modal')?.classList.contains('on') ? 'open' : 'closed'}`, `transform ${d.style.transform || 'none'}`, `peek ${$('#dpeek') ? 'left behind' : 'gone'}`, `overflow ${getComputedStyle(d).overflowY}`, `reading ${document.body.classList.contains('reading')}`, - `shown ${Math.round((Date.now() - shownAt) / 1000)}s ago`, `${S.entries.length} loaded`].join(', ')}); + `shown ${Math.round((Date.now() - shownAt) / 1000)}s ago`, `${S.entries.length} loaded`, + `from x ${Math.round(g.x)}`, `${g.moves} moves seen`, `touch ${g.cancelled ? 'cancelled' : 'left alone'}`, + `slid ${slidAt ? Math.round((Date.now() - slidAt) / 1000) + 's ago' : 'never'}`].join(', ')}); });