The glide re-aims at each scrollend, but a smooth scroll that cannot move
fires no scrollend. On a long transcript, WebKit can stop the glide at the
page's end as the last transcript group renders far shorter than its
estimate; the page shrinks to where the glide already is, the re-aimed
scroll goes nowhere, and the glide waits forever. hold() never runs, so the
section stays hundreds of pixels above the bar.
Watch the page's size during a glide: when the scroll it aimed at, clamped
to the page, is where the page already is, land it as scrollend would.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Why
The goal is that a section link on an episode page lands its section just under the section bar, even after the reader opens a long transcript. In WebKit it didn't: after "Read the full transcript", the More link could leave More episodes about 450px above the bar, and nothing moved it back. This also blocks #130, whose fixture episode hits it in most WebKit runs.
Root cause
The glide re-aims at each
scrollend. A smooth scroll that has nowhere to go fires noscrollend.Traced on #130's fixture episode (landscape phone, WebKit) with an event log in
SectionBar.astroand ResizeObserver and IntersectionObserver probes. Every failing run showed the same sequence after clicking More:scrollend. The glide reads More as 4478px further down, with 4933px of room, and re-aims.scrollendfires. The glide waits for it forever, andhold()never runs. More is left at -454px from its landing (the test's "#more at -438px").A probe that only reads
scrollYon everyscrollevent or animation frame hid the bug (0/8 failing against 5/8 without it), because it changes when WebKit renders the groups. ResizeObserver and IntersectionObserver probes did not hide it, so the trace uses those.Fix
While a glide runs, a ResizeObserver watches the page. When the point the glide aimed at, clamped to the page's new height, is where the page already is, the glide lands as it would on
scrollend. It re-aims if it has tries left, and otherwise hands the section tohold(). That also ends the glide from a link to the section you are already on, which used to wait until your next input.The glide's motion is unchanged. The re-aim count stays at two. The trace shows the count was not the cause.
Before and after
The section-link tests (portrait and landscape), 20 repeats each, 4 workers. Chromium and WebKit ran on the host, Firefox in the Playwright Linux container.
#130's fixture site at 4c614ad, built and served:
Firefox's misses are the same in both builds and happen elsewhere in the test: on the first click on a fresh page, the section is still far below the bar ("#sponsors at 1054px"). This is the Firefox landscape issue #114 already noted.
whiskey.fm content on main (episode 239, dev server):
On a cold dev server, before the fix, 5 WebKit misses were "#more at -474px", the same signature as above. None appeared after the fix. Both builds also miss in other ways only on a cold server, while pages are still compiling: "#more at -178px" (2 before, 2 after) and the More section left far below the bar. I haven't traced those.
Not fixed
🤖 Generated with Claude Code
Summary by CodeRabbit