Repository navigation
Capture: keep scrolling to the bottom as the page grows - #60
Merged
Merged
Conversation
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>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
capture()'s settle pass now re-readsdocument.documentElement.scrollHeighton every step of the lazy-load scroll loop instead of once before it. The bound is still capped atmaxHeight, so the loop ends after at mostceil(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 existingscrollHeight > maxHeightcheck 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
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./lazy-growto thelazy imagesguard-rail loop, and to the corpus manifest and the fixtures README.capture.tschange,/lazy-growfails 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) andnpm run test:visual(327 pass) all pass. No accepted hashes were recorded.Fixes #53
🤖 Generated with Claude Code