Skip to content
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

NO_LCP for mobile, but same element scores correctly on Desktop #16203

Closed
3 tasks done
pwcreative opened this issue Sep 27, 2024 · 2 comments
Closed
3 tasks done

NO_LCP for mobile, but same element scores correctly on Desktop #16203

pwcreative opened this issue Sep 27, 2024 · 2 comments

Comments

@pwcreative
Copy link

pwcreative commented Sep 27, 2024

FAQ

URL

https://pwcreative.com/

What happened?

No performance score for Mobile:

Largest Contentful Paint
Error!
NO_LCP

What did you expect?

Mobile should have a performance score in line with Desktop, because it is the same element, styled in the same way for both contexts.

What have you tried?

There are lots of bug posts online connected to this. The main suggestion was opacity, so I tried setting the starting opacity to greater than zero, which didn't help. I removed the opacity transition altogether, and this still didn't help, so it must be connected to the translate.

Screenshot 2024-09-27 at 10 12 13 Screenshot 2024-09-27 at 10 11 43

The H1 element takes up almost 50% of the screen height and is always on screen but it has nested spans which transform the text content from the top left (offscreen) into position:

.text-3d span {
display: inline-block;
position: relative;
will-change: transform;
transform: translate(-450px, -450px);
transition: transform 500ms ease-in-out 100ms;
}

How were you running Lighthouse?

PageSpeed Insights

Lighthouse Version

LATEST

Chrome Version

Version 129.0.6668.59 (Official Build) (x86_64)

Node Version

No response

OS

Mac

Relevant log output

No response

@adamraine
Copy link
Member

adamraine commented Sep 30, 2024

This looks very similar to #10869. The short summary is that if the LCP element is animated then Chrome can sometimes not detect it properly.

In your case the LCP element is different on desktop & mobile:

  • On desktop it's the "FLUFF" text which is has its position animated
  • On mobile it would be the "We'll assume since..." paragraph which is animated using opacity

Opacity animations appear to be a more common cause of #10869 than position animations, so that might explain why you are still getting an LCP on desktop. The current workaround is to set the initial opacity to something like 0.001 instead of 0.

@pwcreative
Copy link
Author

Strange that the P is considered the LCP, when it's smaller than the H1, but hey, I don't make the rules! I adjusted the opacity and that is now giving us a reading. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants