Skip to content

End a section link's glide when its re-aimed scroll has nowhere to go - #132

Merged
RobbieTheWagner merged 1 commit into
mainfrom
fix/section-link-after-transcript
Dec 5, 2026
Merged

RobbieTheWagner merged 1 commit into
mainfrom
fix/section-link-after-transcript

Conversation

@RobbieTheWagner

@RobbieTheWagner RobbieTheWagner commented Dec 5, 2026 •

Copy link
Copy Markdown
Member

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 no scrollend.

Traced on #130's fixture episode (landscape phone, WebKit) with an event log in SectionBar.astro and ResizeObserver and IntersectionObserver probes. Every failing run showed the same sequence after clicking More:

  1. The transcript opens into four groups of turns. Groups not yet rendered take the first group's height as their estimate, 5043px. The last group really holds a few turns: 111px.
  2. WebKit ends the glide's smooth scroll at y=17999 and fires scrollend. The glide reads More as 4478px further down, with 4933px of room, and re-aims.
  3. Before that scroll starts, the last group renders at 111px. The page shrinks from 23344px to 18411px. The new bottom is y=17999, which is where the page already is.
  4. The re-aimed scroll goes nowhere, so no scrollend fires. The glide waits for it forever, and hold() never runs. More is left at -454px from its landing (the test's "#more at -438px").

A probe that only reads scrollY on every scroll event 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 to hold(). 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:

browser before after
WebKit landscape 13/20 failed (all "#more at -438px") 0/20
WebKit portrait 0/20 0/20
Chromium 0/40 0/40
Firefox landscape 2/20 2/20
Firefox portrait 0/20 0/20

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):

run before after
warm dev server, WebKit 0/40 0/40 (twice)
warm dev server, Chromium 0/40 0/40
warm dev server, Firefox 1/40 1/40
cold dev server (Vite cache cleared), WebKit 9/40 6/40
cold dev server, Chromium 0/40 1/40

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

  • Bug Fixes
    • Improved scroll completion handling when the page reaches its destination without scrolling, and stopped observing page size changes when a glide is aborted.

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>
@RobbieTheWagner RobbieTheWagner added the bug Something isn't working label Dec 5, 2026
@vercel

vercel Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
starpod Ready Ready Preview Dec 5, 2026 8:06am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

glideOn now uses a reusable completion callback. A ResizeObserver invokes it when the clamped glide destination is reached without scrolling. The existing re-aiming checks and abort behavior remain.

Changes: Glide Completion

Layer / File(s) Summary
Completion detection and re-aiming
packages/starpod/src/components/episode/SectionBar.astro
glideOn uses a named completion callback for scroll completion and destination detection. It retains the existing re-aiming checks and disconnects the observer when the glide is aborted.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested labels: bug

Merge Risk: Minimal · up to 444b4

This change ends a section-link glide that would otherwise wait indefinitely when the page shrinks. No concrete merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: a section link glide now ends when the re-aimed scroll, clamped to the new page height, has no distance left to travel. The raw summary and objectives both describe th…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: a section link glide now ends when the re-aimed scroll, clamped to the new page height, has no distance left to travel. The raw summary and objectives both describe this ResizeObserver-driven handling of the no-scrollend case, so the title is specific and on-topic. It does not mention the WebKit page-shrink trigger, but it does not need to.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between f6e4327 and 444b4e1.

Files selected for processing: 1

  • packages/starpod/src/components/episode/SectionBar.astro

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@RobbieTheWagner
RobbieTheWagner merged commit 70fcb5b into main Dec 5, 2026
10 checks passed
@github-actions github-actions Bot mentioned this pull request Dec 5, 2026

This branch was successfully deployed

1 active deployment
Preview — 444b4e1c Deployed Dec 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant