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

[css-contain-2] Should content-visibility apply to elements when size containment has no effect? #7658

Closed
Loirooriol opened this issue Aug 29, 2022 · 2 comments

Comments

@Loirooriol
Copy link
Contributor

https://drafts.csswg.org/css-contain/#content-visibility

Applies to: elements for which layout containment can apply

That is, if

Note that content-visibility can trigger:

  • Layout containment, which is guaranteed to work by "applies to".
  • Paint containment, which is guaranteed to work since it has the same requirements as layout containment.
  • Style containment, which is guaranteed to work since it applies to all elements.
  • Size containment

Size containment has similar requirements:

The difference is that layout containment has effect in a table and table-cell boxes, so content-visibility applies, but size containment has no effect.

Consider this testcase:

<!DOCTYPE html>
<style>table { border: solid } td { border: solid blue }</style>
<table><td style="content-visibility: hidden">Lorem</td></table>
<table style="content-visibility: hidden"><td>Ipsum</td></table>

"Lorem" is not painted in either Firefox nor Chromium. But in Firefox, due to the lack of size containment, the size of the cell takes the contents into account! Seems to follow the spec, but does this make sense? Chromium ignores the requirements and force-applies size containment.

"Ipsum" is similarly not painted in Firefox, while the table takes the size of the contents. Chromium just ignores content-visibility: hidden in this case.

So maybe say that content-visibility doesn't apply when size containment has no effect? And BTW I still think it would make more sense if size containment worked in table cells, see #1791.

@Loirooriol Loirooriol added the css-contain-2 Current Work label Aug 29, 2022
@frivoal
Copy link
Collaborator

frivoal commented Sep 18, 2022

Agenda+ to see if we can change content-visibility to apply to elements for which size containment can apply.

@frivoal frivoal changed the title [css-contain] Should content-visibility apply to elements when size containment has no effect? [css-contain-2] Should content-visibility apply to elements when size containment has no effect? Oct 5, 2022
vmpstr added a commit to vmpstr/csswg-drafts that referenced this issue Oct 19, 2022
@vmpstr vmpstr removed the Agenda+ label Oct 19, 2022
@vmpstr
Copy link
Member

vmpstr commented Oct 19, 2022

Minutes weren't added, but there was a resolution:

RESOLVED: content-visibility applies to elements that can have size containment

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