Open tabatkins opened 4 years ago
This makes sense to me.
I would do some minor bikeshedding to keep visible
as the no-effect value, and perhaps name the auto
state when not skipped can be named something like contained
. So auto
would toggle between contained
and hidden
. It also doesn't change existing meaning of visible
, which is good
That being said, visible
and normal
is maybe OK, but less descriptive in my mind.
I would do some minor bikeshedding to keep visible as the no-effect value
Why?
Why?
For consistency with visibility
and to better differentiate visible
and normal
, both of which read like no-effect values to me
Two points:
These changes sound not web compatible, given the feature has already shipped in one browser.
Regarding:
flipping it to
auto
feels awkward and, depending on scroll position, might not actually make the element visible.
Is it awkward? What is the problem with skipping the element subtree if it isn't on screen anyway?
@chrishtr We're not taking away any values, just changing 'visible' to have a containment side-effect when set explicitly (rather than as the initial value) and giving the initial value a new name.
Generally, you don't want to be flipping containment on/off anyway, right? That impacts layout in significant ways, and the point is to flip visibility without impacting layout, right? So if you're using content-visibility
seems unlikely that you'd want to have containment suddenly flipped off--I'd expect most such pages would be setting contain
themselves to avoid that, in which case they won't be affected by a change here.
@chrishtr We're not taking away any values, just changing 'visible' to have a containment side-effect when set explicitly (rather than as the initial value) and giving the initial value a new name.
Adding a new value is fine, it just needs to be a name that does not break existing content already relying on the current values in Chromium.
Generally, you don't want to be flipping containment on/off anyway, right? That impacts layout in significant ways, and the point is to flip visibility without impacting layout, right?
Agreed. The previous "plan of record" my team was going to pursue was will-change: content-visibility
which would have the same effect, but this works also.
The CSS Working Group just discussed [css-contain-2] apply containment on `content-visibility: visible` ; use `normal` as initial value
, and agreed to the following:
RESOLVED: Have separate keywords for the visbile and contained value vs initial value
The resolution was to come up with a name for this mode and bring it back in a week or two, but a year or two is also good! :)
I believe there are two suggestions, so we should pick out of the following:
content-visibility: normal | visible | hidden | auto
.
normal
: the default state which has no effectvisible
: the state which applies contain: layout style paint
but not size
hidden
: the state which applies contain: layout style paint size
and doesn't paint the contents of the elementauto
: toggles between hidden
and visible
based on relevance to the usercontent-visibility: visible | contained | hidden | auto
visible
: the default state which has no effectcontained
: the state which applies contain: layout style paint
but not size
hidden
: the state which applies contain: layout style paint size
and doesn't paint the contents of the elementauto
: toggles between hidden
and contained
based on relevance to the userI slightly prefer 2, but contained
may be confusing in that it doesn't apply size
containment, so it's kind of partially contained. A possible problem with 1 is that it changes the effect of visible
, so we have to be a bit careful and check if that value is actually being used in developer stylesheets
Currently,
content-visibility
is specified to have three values:visible
, which does nothing;hidden
, which hides the element and applies containments; andauto
, which switches betweenhidden
behavior and a visible-with-containments behavior that is otherwise not representable viacontent-visibility
.This seems weird! Particularly with [
hidden-matchable
](), where the author is expected to flip the element into being visible, flipping it tovisible
is probably wrong (you lose the containments, unless you've applied them independently) and flipping it toauto
feels awkward and, depending on scroll position, might not actually make the element visible.fantasai and I think that it would be better to have an explicit value for each of
auto
’s states, calling themhidden
andvisible
; and to call the initial value, which has no effect on the element,normal
.