From 9e3ffd80c16be7c9b92763625cd6bb7fc22ea595 Mon Sep 17 00:00:00 2001 From: rays Date: Fri, 27 Nov 2026 17:26:41 -0500 Subject: [PATCH] The reader rebuilds its scroller when an item opens on a phone (#450) Every scroll_stuck report since the added fields was a short drag over text in a reader whose content had just been swapped, with nothing over it, nothing inert and the touch left alone by the page: iOS kept the drag and did not scroll. That fits WebKit keeping an overflow box's scroller sized for what was there before. Overflow is taken away for two frames after each open, and after a stuck drag is caught, so the scroller is built again; the report now says how long since the last one, which tells whether this freed it. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01RqkrVCCH8YcP2Y3i8VNYWA --- tests/ui/app.spec.ts | 10 ++++++++++ web/CHANGELOG.md | 1 + web/src/gestures.ts | 15 ++++++++++++++- web/src/items.ts | 1 + 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/tests/ui/app.spec.ts b/tests/ui/app.spec.ts index 3f18d16..97e0565 100644 --- a/tests/ui/app.spec.ts +++ b/tests/ui/app.spec.ts @@ -3306,6 +3306,16 @@ test.describe('on a phone', () => { await expect(row.locator('.pinmark')).toHaveCount(0); }); + test('the reader opened on a phone has its scroller back two frames on, and scrolls (#450)', async ({ page }) => { + await page.locator('#burger').click(); + await page.locator('#feedlist .feed', { hasText: 'Seasoned Show' }).click({ timeout: 20_000 }); + await page.locator('#content .tabs button[data-f="all"]').click(); + await page.locator('#eps .ep .t').first().click(); + const d = page.locator('#detail'); + await expect.poll(() => d.evaluate(el => getComputedStyle(el).overflowY)).toBe('auto'); + expect(await d.evaluate(el => el.style.overflowY)).toBe(''); + }); + test('a page of its own starts its header where a podcast\'s does (#485)', async ({ page }) => { const artX = async (id: string) => { await page.evaluate(id => { selectFeed(id); nav(false); }, id); diff --git a/web/CHANGELOG.md b/web/CHANGELOG.md index 1a6aaad..229ea9f 100644 --- a/web/CHANGELOG.md +++ b/web/CHANGELOG.md @@ -41,6 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - On a phone, the line under an unread episode's title starts where the title does, past its dot, and the date sits on the title's line instead of between the two (#500). +- On an iPhone, the reader rebuilds its scrolling each time an item opens, and again after a drag that did not move it, so a freshly opened item scrolls on the first try (#450). - The count under All Subscriptions counts only its own unread items, not those of feeds hidden from it, so it agrees with the header (#499). - An item without a title is named in bold like the rest of the list, not in regular weight beside them (#498). - The X on a playlist's episode marks it played again; it did nothing (#497). diff --git a/web/src/gestures.ts b/web/src/gestures.ts index 3d99725..e743eb3 100644 --- a/web/src/gestures.ts +++ b/web/src/gestures.ts @@ -243,7 +243,20 @@ document.addEventListener('touchend', ev => { if(stuckDrag(dy, dx, g.top, d.scrollTop, room)) stuck(d, t, g, dy, room, ms); }, 300); }); +/// Makes iOS build the reader's scroller again (#450): every stuck drag was on a reader whose +/// content had been swapped, with nothing over it and the touch left alone, which is WebKit keeping +/// a scroller sized for what was there before. Two frames without overflow, so the hidden state is +/// committed and not merged away with the change back. +function rearm(d: HTMLElement){ + d.style.overflowY = 'hidden'; + requestAnimationFrame(() => requestAnimationFrame(() => { d.style.overflowY = ''; })); +} +let stuckAt = 0; function stuck(d: HTMLElement, t: Touch, g: NonNullable, dy: number, room: number, ms: number){ + rearm(d); + // A second report soon after the first says rearm did not free it. + const again = stuckAt ? Math.round((Date.now() - stuckAt) / 1000) + 's ago' : 'never'; + stuckAt = Date.now(); const inert = ([...document.body.children] as HTMLElement[]).filter(el => el.inert).map(named).join(' '); report('scroll_stuck', {feed: S.feed, state: [ `top ${g.top} of ${room}`, `drag ${Math.round(dy)}px`, `started on ${g.on}`, @@ -253,5 +266,5 @@ function stuck(d: HTMLElement, t: Touch, g: NonNullable, dy: number `overflow ${getComputedStyle(d).overflowY}`, `reading ${document.body.classList.contains('reading')}`, `shown ${Math.round((Date.now() - shownAt) / 1000)}s ago`, `${S.entries.length} loaded`, `from x ${Math.round(g.x)}`, `${g.moves} moves seen in ${ms}ms`, `touch ${g.cancelled ? 'cancelled' : 'left alone'}`, - `slid ${slidAt ? Math.round((Date.now() - slidAt) / 1000) + 's ago' : 'never'}`].join(', ')}); + `slid ${slidAt ? Math.round((Date.now() - slidAt) / 1000) + 's ago' : 'never'}`, `last stuck ${again}`].join(', ')}); } diff --git a/web/src/items.ts b/web/src/items.ts index 532f45b..f314533 100644 --- a/web/src/items.ts +++ b/web/src/items.ts @@ -425,6 +425,7 @@ function showDetail(e: Entry|null){ const narrow=!!window.matchMedia?.('(max-width:820px)')?.matches; box.innerHTML=detailHtml(e); if(files) files.innerHTML=narrow?'':`
Files
${encs}`; + if(narrow) rearm(box); $('#dback').onclick=()=>showDetail(null); const view=box.querySelector('.tview'); if(view) view.onchange=()=>{