question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

First Contentful Paint ignores opacity: 0 in some situations

See original GitHub issue

Provide the steps to reproduce

  1. Run LH on https://demo.tannerhodges.com/vitals/fcp/opacity.html.
  2. Compare to https://demo.tannerhodges.com/vitals/fcp/index.html.

👉 See source code: https://github.com/tannerhodges/core-web-vitals/tree/main/fcp

What is the current behavior?

Lighthouse reports that FCP is the same (and sometimes better) when the body is hidden with opacity: 0 and revealed later during page load than when that style is removed and the page renders as quickly as possible.

For example, compare these WebPageTest filmstrips for the files above:

opacity.html index.html
FCP reports times faster when the body has opacity: 0 FCP reports slower times when the body renders as soon as possible
WebPageTest video for opacity.html View WebPageTest video for index.html
WebPageTest summary for opacity.html WebPageTest summary for index.html

Lighthouse correctly reports that LCP was faster in index.html, but incorrectly reports that FCP was slower. (Apparently, opacity.html rendered even sooner than the page appears in either video… 👀)

This is unexpected, and the effect grows in larger projects with similar code patterns.

In some cases, removing opacity: 0 from the body can increase FCP by as much as 1 second or more—even though the page is actually rendering much faster. 👇

Example where FCP reports ≈1s worse, even thought the page renders ≈2s faster

Unfortunately I can’t share the code for this particular project but hopefully the reduced test case replicates the same issues well enough to debug what’s going on.

What is the expected behavior?

  • Per the Paint Timing spec, elements with opacity: 0 should not be considered paintable.
  • First Contentful Paint should fire later in opacity.html than in index.html.
  • In these examples, FCP and LCP should both match since the h1 is the first & largest contentful element to render on the page.

Environment Information

  • Affected Channels: CLI, DevTools, and others. (I’ve confirmed the same result in PageSpeed Insights and WebPageTest.)
  • Lighthouse version: 6.4.1
  • Chrome version: 86.0.4240.111
  • Node.js version: 14.15.0
  • Operating System: macOS 10.15.7

Related issues

I’m still trying to get my head around Lighthouse’s internals / which issues are actually relevant, but here are some I across while researching this that might (?) help:

I’ve also experienced similar issues with CLS ignoring opacity: 0, so in case the topic of paintable elements overlaps with FCP here are those issues:


P.S. At this point I’m not sure whether this should be considered a Lighthouse bug or a Chrome bug. Appreciate any insight y’all have as to what’s going on here / next steps I should take.

Let me know if there’s any additional information I can provide.

🙏 Thanks for the help.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
tannerhodgescommented, Nov 20, 2020

🙌 Fantastic!

I’m so relieved, I can finally take down my conspiracy wall.

FCP does not exist

Thank you again @patrickhulce for your feedback, resources, and help digging into this.

Excited to see it on its way to getting fixed.

2reactions
patrickhulcecommented, Nov 19, 2020

Wow, OK found the issue and filed https://bugs.chromium.org/p/chromium/issues/detail?id=1151054. Amazing work @tannerhodges hopefully we’ll get a fix in Chromium soon 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issue 1104218: LCP missing candidates painted with opacity ...
Summary: LCP missing candidates painted with opacity 0 then animated to non-zero (was: Largest Contentful Paint is not computed).
Read more >
How CSS opacity animations can delay the Largest Contentful ...
How CSS opacity animations can delay the Largest Contentful Paint ... This changes the opacity 0 paints that are ignored by the LCP ......
Read more >
Chrome Speed - First Contentful Paint Changes in M94
In Chrome 94, we make sure that paint timing is not triggered by content that is not visible due to being under the...
Read more >
Get a perfect Largest Contentful Paint (LCP) time with a single ...
Websites will soon be penalized in Google's search rankings for poor performance in any of these 3 metrics. Since we work with a...
Read more >
Optimize Largest Contentful Paint - web.dev
Here are some examples where the LCP resource cannot be discovered from scanning the HTML document response: The LCP element is an <img>...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found