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 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 01:39:34 +00:00
parent b046e66e54
commit 9035306e22

View File

@@ -118,6 +118,7 @@ function beside(dx: number){
/// beside it with it. /// beside it with it.
function slide(dx: number, ms = 160){ function slide(dx: number, ms = 160){
const d = $('#detail'); if(!d) return; 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 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'; const w = d.clientWidth || 1, tr = ms ? `transform ${ms}ms ease-out, opacity ${ms}ms ease-out` : 'none';
d.style.transition = tr; 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, /// 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, /// 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. /// 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(); }); document.addEventListener('visibilitychange', () => { if(!document.hidden) shownAt = Date.now(); });
const named = (el: Element | null) => !el ? 'nothing' const named = (el: Element | null) => !el ? 'nothing'
: el.id ? '#' + el.id : el.tagName.toLowerCase() + (typeof el.className === 'string' && el.className ? '.' + el.className.split(' ')[0] : ''); : 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; if(ev.touches.length !== 1 || !d || !S.sel) return;
const r = d.getBoundingClientRect(); const r = d.getBoundingClientRect();
if(t.clientX < r.left || t.clientX > r.right || t.clientY < r.top || t.clientY > r.bottom) return; 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}); }, {passive: true});
document.addEventListener('touchmove', () => { if(drag) drag.moves++; }, {passive: true});
document.addEventListener('touchend', ev => { document.addEventListener('touchend', ev => {
const d = $('#detail'), t = ev.changedTouches[0], g = drag; const d = $('#detail'), t = ev.changedTouches[0], g = drag;
drag = null; drag = null;
@@ -235,5 +243,7 @@ document.addEventListener('touchend', ev => {
`inert ${inert || 'none'}`, `dialog ${$('#modal')?.classList.contains('on') ? 'open' : 'closed'}`, `inert ${inert || 'none'}`, `dialog ${$('#modal')?.classList.contains('on') ? 'open' : 'closed'}`,
`transform ${d.style.transform || 'none'}`, `peek ${$('#dpeek') ? 'left behind' : 'gone'}`, `transform ${d.style.transform || 'none'}`, `peek ${$('#dpeek') ? 'left behind' : 'gone'}`,
`overflow ${getComputedStyle(d).overflowY}`, `reading ${document.body.classList.contains('reading')}`, `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(', ')});
}); });