Repository navigation
Description
Summary
images/offscreen-lazy reports an image as "below-fold without lazy loading" although it is the first content image at the top of the page. It looks like the rule decides "below the fold" by image order (after a few small header icons) rather than by position.
Real case: a blog author header image rendered at y=127 px (viewport height 744 px) on a Shopify page is reported below-fold on every page of the template, so the site gets a fix advice (loading="lazy" on an above-fold image) that would hurt LCP.
Minimal repro
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Image weight rule repro page for squirrel audits</title></head><body>
<header>
``<img src="small.jpg" width="24" height="24" alt="Icon 1"><img src="small.jpg" width="24" height="24" alt="Icon 2">``
````<img src="small.jpg" width="24" height="24" alt="Icon 3"><img src="small.jpg" width="24" height="24" alt="Icon 4">````
</header>
<main>`````<img src="small.jpg" width="400" height="120" alt="Header image">`````<h1>Hero after icons</h1><p>Short intro.</p></main>
</body></html>squirrel audit http://localhost:8766/hero.html --http -f json -o out.jsonActual
{"ruleId":"images/offscreen-lazy","status":"warn","message":"2 below-fold image(s) without lazy loading","items":[{"id":"small.jpg"}]}Expected
No finding: all images sit within the first ~150 px of the page. Without layout (--http), small images with explicit width/height (icons, logos) should not count toward the "above-fold budget", or the rule should stay silent when it cannot tell, rather than recommend lazy loading for a top-of-page image. Control: the same page without the four icons yields no finding.
Version
squirrel 0.0.138 (macOS arm64), --http mode.
Triage
Confirmed against current main. packages/rules/src/images/offscreen-lazy.ts takes imagesArray.slice(opts.above_fold_count) as the below-fold set, so the split is purely by document order. Four small icons use up the default above-fold budget and the first real content image lands in the below-fold set.
Acceptance Criteria
- The repro page above produces no
images/offscreen-lazyfinding in--httpmode. - Small images with explicit
widthandheight(icons, logos) do not consume the above-fold budget when there is no layout information. - A page with enough large content images before a late image still reports that late image as below-fold without lazy loading.
- A regression test covers the icons-then-hero case, and the rule docs describe how the above-fold budget is counted.
Activity
fix(rules): count the initial viewport in content images, measure the…
nc9 commentedon Oct 30, 2026
Shipped in v0.0.143 (commits e54a36d). Checked every acceptance criterion against current main: the initial viewport is counted for content images, with tests.
nik