Why it matters
- Largest Contentful Paint (LCP) measures when the largest image or text block of the first screen appears; it is one of the Core Web Vitals.
- web.dev says: "Never lazy-load your LCP image, as that will always lead to unnecessary resource load delay". With
loading="lazy", the image is not fetched "until after layout confirms the image is in the viewport". - An image a script loads late is worse: its address is not in the HTML, so the browser cannot start early. web.dev calls this "never optimal".
- Lazy loading is right for images further down the page; the first screen's main image is the one exception.
Example
<img id="hero" src="/images/hero.svg" loading="lazy" width="360" height="270" alt="نقش سدو أحمر ورملي" />
<img id="hero" src="/images/hero.svg" fetchpriority="high" width="360" height="270" alt="نقش سدو أحمر ورملي" />
How to fix
Load the first screen's main image at once, and give it priority:
html
<img id="hero" src="/images/hero.svg" fetchpriority="high" width="360" height="270" alt="نقش سدو أحمر ورملي" />- Remove
loading="lazy", and the lazy-loading script's class anddata-src, from this one image; keep them on the images below it. - In a store theme, the setting is often called "lazy load the first image" or similar.
How we detect
- We render the page at phone size and read the element of the largest contentful paint, as Chromium and Firefox report it (WebKit reports none).
- We report it when it is an
<img>withloading="lazy", or any element with the marks of a lazy-loading script:data-src,data-srcset,data-lazy-src, or alazyloadorlazyclass. - The largest element can differ at another screen size; we judge the phone's.