Skip to content

Commit

Permalink
[css-anchor-position] Fix the definitions for position-visibility: an…
Browse files Browse the repository at this point in the history
…chors-visible
  • Loading branch information
tabatkins committed Apr 5, 2024
1 parent ff62553 commit dcc8029
Showing 1 changed file with 34 additions and 13 deletions.
47 changes: 34 additions & 13 deletions css-anchor-position-1/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1008,14 +1008,20 @@ Conditional Hiding: the 'position-visibility' property {#position-visibility}

<pre class=propdef>
Name: position-visibility
Value: always | anchors-valid || anchors-visible || no-overflow
Value: always | [ anchors-valid || anchors-visible || no-overflow ]
Initial: anchors-visible
Applies to: [=absolutely-positioned=] elements
Percentages: n/a
Inherited: no
Animation type: discrete
</pre>

There are times when an element's anchors
are not appropriate for positioning the element with,
and it would be better to simply not display the element at all.
'position-visibility' provides several conditions
where this could be the case.

<dl dfn-type=value dfn-for=position-visibility>
: <dfn>always</dfn>
::
Expand Down Expand Up @@ -1045,10 +1051,9 @@ Animation type: discrete

: <dfn>anchors-visible</dfn>
::
If the element does not have a [=default anchor element=],
or it has a [=default anchor element=]
but the anchor element is [=clipped by scrolling=],
this element is [=strongly hidden=].
If the element has a [=default anchor element=]
but the anchor element is [=clipped by intervening elements=],
this element is also [=strongly hidden=].

Issue: Since only the [=default anchor element=]
triggers scroll-compensation,
Expand All @@ -1062,15 +1067,31 @@ Animation type: discrete
then the element is [=strongly hidden=].
</dl>

For the purposes of this property,
an anchor element is <dfn noexport>clipped by scrolling</dfn>
if its [=ink overflow rectangle=]
is fully outside the [=scrollport=]
of one of its scrollable ancestors.
<div algorithm>
An anchor element |anchor|
is <dfn noexport>clipped by intervening elements</dfn>
relative to a positioned element |abspos| relying on it
if |anchor|'s [=ink overflow rectangle=]
is fully clipped by an element
which is an ancestor of |anchor|
but a descendant of |abspos|'s containing block.
This "clipping" can be due to the ancestor being a [=scroll container=],
or being clipped to its [=overflow clip edge=]
(such as by ''overflow: clip'' or [=paint containment=]).

Issue: Should any other clipping matter?
The 'clip'/'clip-path'/'mask' properties?
''opacity: 0''?

Note: This means that if an abspos is next to its anchor in the DOM,
for example,
it'll remain visible even if its default anchor is scrolled off,
since it's clipped by the same scroller anyway.

Issue: Make sure this definition of clipped
is consistent with View Transitions,
which wants a similar concept.
Issue: Make sure this definition of clipped
is consistent with View Transitions,
which wants a similar concept.
</div>

Making an element <dfn noexport>strongly hidden</dfn>
makes it act as if it
Expand Down

0 comments on commit dcc8029

Please sign in to comment.