Open patrickhulce opened 3 years ago
That has definitely come up in the past but doesn't seem super common. You're right that this is not ideal but I will pass on the feedback to the rendering team who will have more informed opinions on whether it is computationally feasible to consider occlusion.
I think the spec shouldn't deal with it. UAs can try to track this and put warning-ish things in their dev-tools like "your LCP is occluded".
@noamr - why shouldn't we handle this at the spec level? (assuming implementation of this is feasible, that's still TBD)
@noamr - why shouldn't we handle this at the spec level? (assuming implementation of this is feasible, that's still TBD)
because occlusion is a really hard problem to solve in an interoperable way. The value of solving it here is not high - if a large image is completely occluded, maybe the occluding content is more important to the users? But this is an opinion and open for discussion.
I have noticed the same issue on my photography site where I visually stack some photos above each other. The one in the back if reported as the LCP, while we can see only a little part of it: https://mamot.fr/@nhoizey/110496230467676162
Here's a WebPageTest result: https://www.webpagetest.org/vitals.php?test=230606_BiDc1E_6ZR&run=3&cached=0#lcp
Tricky situation here: the image in the back is overall smaller than the one in the front, but the fold "cuts" the bottom of the later, so the area above the fold considered for LCP is larger for the back image.
But I think the back image should not be the LCP anyway, as we don't see much of it.
We came across an amusing case in Lighthouse where the LCP element was completely obscured by another element with a higher z-index.
It's definitely unfortunate that LCP flags something that is effectively outside the viewport from the user's perspective. I can imagine that determining occlusion would be computationally expensive (and impossible in some cases) though. Would it be possible to consider more forms of visibility like this in the metric definition? Was there consideration or a discussion on this in the past I can refer to?