GoogleChrome / GoogleChrome/lighthouse

Reward `content-visibility` use in the dom-size audit

Open
#14,691 0 comments 0 reactions 1 assignee View on GitHub

@brendankenny is already working on this.

Since Jan 18, 2023.

P2
Dominant language
JavaScript
Stars
30.8k
Forks
9.8k
Avg merge
1d 14h
Merged PRs (30d)
20

Description

## `content-visibility` recap

**EDIT: see an updated version of this here: https://gist.github.com/paulirish/613cfe5a269ead0e27b1b33e950a342d**

`content-visibility: auto` is basically `rendering=lazy` .. or it's like the `

strict containment should probably be accounted for..

- Some subtree with `contain: strict` shouldn't add additional depth into maxDepth.
- And elements with strict shouldn't be included in maxWidth.
- If we're looking at `contain: strict` explicitly (without c-v), then.. i'm not sure how to discount the `totalBodyElements` count. Cost wise, they're not 100% free, but they're very different. Charging them at 15% feels right, but that's awkward.

`c-v: auto` feels slightly different than strict containment. Because as long as elements are in their _skipped_ state (out of viewport, etc), then they are like 100% free. We _could_ use the new `contentvisibilityautostatechange` event to determine which of the `c-v:auto` elements are rendered vs not. Rendered we count (at a discount) and non-rendered are free.

Alternatively, we could over-reward c-v:auto (and contain:strict) and call all uses free wrt this audit. We'd probably tweak the description to clarify we only include elements attached to the body's style tree. (ish).

I'm fine with the latter, and its certainly more straightforward for us.

Regardless, our dom-size audit/docs should advocate for c-v as it's the perfect solution.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.