Skip to content

[css-sizing-4] Only apply contain-intrinsic-size: auto with content-visibility: auto #6308

Closed
@cbiesinger

Description

@cbiesinger

https://drafts.csswg.org/css-sizing-4/#intrinsic-size-override

If auto applies to everything, you can into the situation where an element is visible on screen but rendered with outdated dimensions. For example:

<div style="contain-intrinsic-size: auto 100px; float: left; width: 200px;"></div>

Now, if JS adds contain: size; width: auto;, the element will be rendered at 200px width, even though this size is neither in the current CSS style not is it related to the content size.

This is an unfortunate situation. To fix this, we would like to propose only applying auto if the element also has content-visibility: auto. This would ensure that the remembered size is only used if the element is offscreen, where an outdated size will only affect the scrollbar size.

Thoughts?

@dbaron @chrishtr @vmpstr @tabatkins

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions