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=()=>{