Skip to content

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

Closed

Description

@tmashara

What
The lazy-load scroll pass in capture.ts reads scrollHeight once, before the loop (const h = Math.min(document.documentElement.scrollHeight, maxHeight)). Content that grows the page while it's being scrolled (infinite lists, lazy sections, images without dimensions) is never scrolled to, so it isn't loaded.

Why
The shot is still taken full-page, so the bottom of such a page is captured unloaded on both sides, or differently on each side, and shows up as a diff or quietly as matching placeholders. yanfishel/visual-regression-test re-reads the height on every step (apps/worker/src/stabilize.ts, buildScrollSettleScript).

How
Use Math.min(document.documentElement.scrollHeight, maxHeight) as the loop condition, and cap the number of steps (e.g. maxHeight / innerHeight + 1) so a page that grows forever still ends. A regression test: a fixture that appends a section when scrolled near its bottom.

Activity

  1. added
    bug
    on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions