Largest Contentful Paint Error on Google Chrome Lighthouse Report

3.6k Views Asked by At

I'm receiving an Error ! for the Performance tab on the Google Chrome Lighthouse report. I tried to fix but I was unable to, any advice?

This is the following error: Largest Contentful Paint Error! The page did not display content that qualifies as a Largest Contentful Paint (LCP). Ensure the page has a valid LCP element and then try again. (NO_LCP)

On Diagnostics, it has an error:

Preconnect to required origins Error! Consider adding preconnect or dns-prefetch resource hints to establish early connections to important third-party origins. Learn how to preconnect to required origins.FCPLCP. https://developer.chrome.com/docs/lighthouse/performance/uses-rel-preconnect/?utm_source=lighthouse&utm_medium=devtools [enter image description here](https://i.stack.imgur.com/dbZoA.png)

I added the following link tag to my app.js file but it did not fix the error. I added it to preconnect to google fonts, although I am using NextJS's next/font. Resource https://nextjs.org/docs/messages/google-font-preconnect <link rel="preconnect" href="https://fonts.gstatic.com" /> [enter image description here](https://i.stack.imgur.com/PWMc8.png)

1

There are 1 best solutions below

1
On BEST ANSWER

Interesting! I think this error is a combination of two things:

  • the background image covers the full screen
  • the text content fades in

According to https://web.dev/lcp/#what-elements-are-considered, fullscreen images (eg background images) are excluded from being considered LCP elements. Also, elements with 0 opacity are excluded.

Given that all of the page contents are either a fullscreen background image or faded in, nothing qualifies as the LCP element.

One could argue that the "We Empower Ideas" H1 should be counted as the LCP element after it fades in, but it would need to be repainted first.

More info in this article: https://www.debugbear.com/blog/opacity-animation-poor-lcp

So I'd suggest removing the fade effect from the text to ensure that it gets counted as the LCP element accurately.