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

Add intersectionRect (from element timing) to LCP? #127

Open
mmocny opened this issue Dec 11, 2024 · 5 comments
Open

Add intersectionRect (from element timing) to LCP? #127

mmocny opened this issue Dec 11, 2024 · 5 comments

Comments

@mmocny
Copy link

mmocny commented Dec 11, 2024

LCP entries expose a size but not an intersectionRect.

Is there a specific reason?

Having the full rect is quite useful especially for cases such as:

  • the element becomes null for reporting
  • the sizing of the element is constrained to a bounding box that does not match getBoundingClientRect()
    • (and as far as I know getting a tight bounding box is really hard and involves manually parsing computed styles)
  • Useful to visualize cases when surprising candidates or sizes are computed (i.e. when there are nested inline text nodes, etc).
@mmocny
Copy link
Author

mmocny commented Dec 11, 2024

Looking at the algorithm for LCP, it is explicitly taking an intersectionRect as computed by element timing and then converting just to a single size:

https://w3c.github.io/largest-contentful-paint/#potentially-add-a-largestcontentfulpaint-entry

@mmocny
Copy link
Author

mmocny commented Dec 11, 2024

...meanwhile element timing does not expose size.

I think these entry types should try to be as similar as possible, no? Then you can share a sinlge PerformanceObserver, for example.

@clelland
Copy link
Collaborator

I agree; this would have been really useful in a number of debugging situations. I don't know if this was an oversight in the original design or not, but it would be a useful addition now.

@bdekoz
Copy link

bdekoz commented Dec 12, 2024

agree. Moz has an existing feature request for a use case for Michal's third point above, aka "Useful to visualize cases when surprising candidates.."

@mmocny
Copy link
Author

mmocny commented Dec 12, 2024

Excellent! I'll ask if we can add to the WG meeting schedule, just to confirm this is not intentional for some obscure historical reason.

Should be trivial to patch into spec.

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

No branches or pull requests

3 participants