Skip to content

Capture: keep scrolling to the bottom as the page grows - #60

Merged
tmashara merged 1 commit into
mainfrom
claude/issue-53-scroll-regrow
Oct 29, 2026
Merged

tmashara merged 1 commit into
mainfrom
claude/issue-53-scroll-regrow

Conversation

@tmashara

Copy link
Copy Markdown
Owner

What

capture()'s settle pass now re-reads document.documentElement.scrollHeight on every step of the lazy-load scroll loop instead of once before it. The bound is still capped at maxHeight, so the loop ends after at most ceil(maxHeight / innerHeight) steps. No separate step counter is needed.

Why

When a page added content as it was scrolled (an infinite list or a lazy section), the loop stopped at the height it read at the start. The added content was never scrolled into view, so its IntersectionObserver loaders never fired and its images showed up empty in the shot.

Behaviour change to note

A page that keeps growing forever now errors where it used to pass quietly. An infinite feed is scrolled until it reaches maxHeight (40,000px at 1440, 153,600px at 375). Then the existing scrollHeight > maxHeight check throws "past the sanity ceiling". Before this change it captured roughly the first screenful plus one batch. At 375 that can take about 170 steps (8s or more). The step cap suggested in the issue gives the same bound, so it doesn't avoid this. If feed pages should stay capturable, a follow-up could use a much lower cap, for example a few times the first height.

Tests

  • New guard-rail fixture tests/fixtures/pages/lazy-grow. The left side appends a 2,400px section and a gallery when the bottom scrolls into view, and lazy-loads the gallery with an IntersectionObserver. The right side has the same content in the markup.
  • Added /lazy-grow to the lazy images guard-rail loop, and to the corpus manifest and the fixtures README.
  • Checked that the test catches the bug: without the capture.ts change, /lazy-grow fails at both 1440 and 375 (2 of 2 shots differ). With the change it passes, and it passed on two separate runs.
  • npm run typecheck, lint, format:check, npm test (287 pass) and npm run test:visual (327 pass) all pass. No accepted hashes were recorded.

Fixes #53

🤖 Generated with Claude Code

The settle pass read scrollHeight once, so sections a page appends while
scrolled (infinite lists, lazy sections) were never reached and their lazy
images never loaded. Re-read it each step, still bounded by maxHeight.

Adds the lazy-grow guard-rail fixture.

Fixes #53

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tmashara
tmashara merged commit 8e81390 into main Oct 29, 2026
3 checks passed
@tmashara
tmashara deleted the claude/issue-53-scroll-regrow branch October 29, 2026 15:38
@tmashara tmashara mentioned this pull request Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Re-read page height in the lazy-load scroll pass

1 participant