Skip to content

Update the algorithm for lastPaintedElement#61

Open
jasonwilliams wants to merge 2 commits into
WICG:mainfrom
jasonwilliams:lastPaintedElementChange
Open

Update the algorithm for lastPaintedElement#61
jasonwilliams wants to merge 2 commits into
WICG:mainfrom
jasonwilliams:lastPaintedElementChange

Conversation

@jasonwilliams

@jasonwilliams jasonwilliams commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Related to: #53

This changs the semantic of lastPaintedElement to be the largest element of that frame which was painted, rather than an arbirtary last element which isn't deterministic and can be left open to interpretation.


Preview | Diff

@mmocny

mmocny commented Jul 2, 2026

Copy link
Copy Markdown

This looks like an improvement in spec wording to me, however, you might be interested in: w3c/largest-contentful-paint#171

Basically, this splits the "LCP selection" from new LCP emission parts of the LCP spec.

You pass a set of new contentful elements (just as paint timing gives) and you get back the single largest one from that set. If you pass an existing LCP candidate to that list, you will only get back a new candidate that is larger than the previous.

For container timing, I think you can:

  • Pass all new element paints, without passing a previous LCP candidate, to get the largest for this new paint, with all the same selection and "effective size" semantics (not just rect based).
  • For the proposed nested LCP, you can pass the currently running largest LCP candidate so you only get a new one if there is a new largest overall.

@mmocny

mmocny commented Jul 2, 2026

Copy link
Copy Markdown

@shaseley

@mmocny

mmocny commented Jul 2, 2026

Copy link
Copy Markdown

And you can read how we integrated into soft-navs / icp spec here: https://wicg.github.io/soft-navigations/#report-interaction-contentful-paints-and-soft-navigations

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

Successfully merging this pull request may close these issues.

2 participants