-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Responsive LCP image penalized for lazy-loading by lcp-lazy-loaded audit #16034
Comments
Is there any reason you can't use |
Using a My interest here is specifically in the context of developing optimizations on top of WordPress Core. I'm working to take the existing markup generated by the theme and prioritize the loading of the LCP image based on the current viewport. WordPress doesn't support |
I think you could still get I think we will adopt your suggestion of allowing images with |
FAQ
URL
https://comparing-lcp-images-with-lazy-loading-and-fetchpriority-high.glitch.me/lazy-loaded-lcp-image-with-fetchpriority-high-preload-link.html
What happened?
Consider a page which shows a different image depending on whether it is a desktop or mobile device. In order to prevent both images from being loaded on both device form factors, it is necessary to add
loading=lazy
to the images:Nevertheless, since these are LCP images for their respective viewport sizes, they also must be loaded with
fetchpriority=high
which can be achieved with preload links that include media queries:Nevertheless, the lcp-lazy-loaded audit is failing for such a page (PSI):
This is in spite of the fact that such images load comparably fast to
img
tags withfetchpriority=high
:The LCP-TTFB metric comes from the benchmark-web-vitals command in the GoogleChromeLabs/wpp-analysis repo. It reflects the LCP time subtracting the TTFB. The value is the median over 25 requests using the following command:
For more info, see the Glitch.
What did you expect?
The lcp-lazy-loaded should not have failed.
What have you tried?
I suggest that the following code in the audit be modified:
lighthouse/core/audits/lcp-lazy-loaded.js
Line 88 in a1d424e
Given the LCP image's
src
andsrcset
it should also check if there is a preload link withfetchpriority=high
which has the correspondinghref
andimagesrcset
attribute values. If so, thenwasLazyLoaded
should be consideredfalse
.How were you running Lighthouse?
PageSpeed Insights, Chrome DevTools
Lighthouse Version
12.0.0
Chrome Version
No response
Node Version
No response
OS
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: