-
Notifications
You must be signed in to change notification settings - Fork 27
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
css-contain-2 and contain-intrinsic-size #189
Comments
I have a question in #133 (comment) about how this would add up with the Container Queries proposal and the 2022 containment focus area. |
There were two mentions of |
In the MDN short survey on CSS & HTML, "CSS containment ( |
Thank you for proposing css-contain-2 and We are pleased to let you know that this proposal was accepted as part of the Containment focus area. You can follow the progress of this Focus Area on the Interop 2023 dashboard. For an overview of our process, see the proposal selection summary. Thank you for contributing to Interop 2023! Posted on behalf of the Interop team. |
Description
CSS Containment Module, Level 2, specifies the
contain
andcontent-visibility
properties. The contain-intrinsic-size property is specified in CSS Sizing Module, Level 4.
The proposal is for the following properties:
content-visibility: hidden
value.content-visibility: auto
value.contain-intrinsic-size
css property, supporting all values.Rationale
CSS Containment Module Level 2 provides performance primitives to help developers
scale their content. Specifically the
content-visibility
property enablesdevelopers to control how much or how little of their content is rendered:
content-visibility: hidden
allows pages to represent hidden or cached SPA route content in the DOM without paying a rendering cost.content-visibility: auto
allows pages to avoid rendering cost for content not currently in or near the viewport.The
contain
CSS property is a prerequisite forcontent-visibility
, but that is already part of Interop 2022. Thecontain-intrinsic-size
property is important to provide an easy way to reserve placeholder sizing forcontent-visibility
subtrees. It also enables fullcontent-visibility: auto
adoption without the need for any script.When compared to
display: none
,content-visibility: auto
elements have anadded benefit of being searchable by find-in-page, and available to assistive
technologies via the accessibility tree. This further unlocks features such as
hidden=until-found
and automatic searchability of content in<details>
elements.Implementor status:
css-contain-2
, includingcontent-visibility
is implemented. Over 4% of page loads usecontent-visibility
, despite it only being available in Blink at the moment.Community feedback:
Vincent Riemer, React / Meta engineer:
Addy Osmani, Google engineer:
Benoit Girard, Databricks engineer, ex-Meta engineer:
Article:
https://web.dev/content-visibility/
Specification
https://www.w3.org/TR/css-contain-2/
https://www.w3.org/TR/css-sizing-4/
Tests
https://wpt.fyi/results/css/css-contain/content-visibility
https://wpt.fyi/results/css/css-contain
https://wpt.fyi/results/css/css-sizing/contain-intrinsic-size
The text was updated successfully, but these errors were encountered: