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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RqkrVCCH8YcP2Y3i8VNYWA
This commit is contained in:
2026-11-27 17:26:41 -05:00
parent 1f4ad44da8
commit 9e3ffd80c1
4 changed files with 26 additions and 1 deletions

View File

@@ -3306,6 +3306,16 @@ test.describe('on a phone', () => {
await expect(row.locator('.pinmark')).toHaveCount(0); 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 }) => { test('a page of its own starts its header where a podcast\'s does (#485)', async ({ page }) => {
const artX = async (id: string) => { const artX = async (id: string) => {
await page.evaluate(id => { selectFeed(id); nav(false); }, id); await page.evaluate(id => { selectFeed(id); nav(false); }, id);

View File

@@ -41,6 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### 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 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). - 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). - 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). - The X on a playlist's episode marks it played again; it did nothing (#497).

View File

@@ -243,7 +243,20 @@ document.addEventListener('touchend', ev => {
if(stuckDrag(dy, dx, g.top, d.scrollTop, room)) stuck(d, t, g, dy, room, ms); if(stuckDrag(dy, dx, g.top, d.scrollTop, room)) stuck(d, t, g, dy, room, ms);
}, 300); }, 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<typeof drag>, dy: number, room: number, ms: number){ function stuck(d: HTMLElement, t: Touch, g: NonNullable<typeof drag>, 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(' '); const inert = ([...document.body.children] as HTMLElement[]).filter(el => el.inert).map(named).join(' ');
report('scroll_stuck', {feed: S.feed, state: [ report('scroll_stuck', {feed: S.feed, state: [
`top ${g.top} of ${room}`, `drag ${Math.round(dy)}px`, `started on ${g.on}`, `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<typeof drag>, dy: number
`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`, `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'}`, `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(', ')});
} }

View File

@@ -425,6 +425,7 @@ function showDetail(e: Entry|null){
const narrow=!!window.matchMedia?.('(max-width:820px)')?.matches; const narrow=!!window.matchMedia?.('(max-width:820px)')?.matches;
box.innerHTML=detailHtml(e); box.innerHTML=detailHtml(e);
if(files) files.innerHTML=narrow?'':`<div class="fhd">Files</div>${encs}`; if(files) files.innerHTML=narrow?'':`<div class="fhd">Files</div>${encs}`;
if(narrow) rearm(box);
$<HTMLButtonElement>('#dback').onclick=()=>showDetail(null); $<HTMLButtonElement>('#dback').onclick=()=>showDetail(null);
const view=box.querySelector<HTMLSelectElement>('.tview'); const view=box.querySelector<HTMLSelectElement>('.tview');
if(view) view.onchange=()=>{ if(view) view.onchange=()=>{