Skip to content

Commit 7e992cb

Browse files
committed
[css-anchor-position][editorial] Provide some detail on exactly what the limitations of scroll adjustment are.
1 parent 06f7824 commit 7e992cb

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

css-anchor-position-1/Overview.bs

+38
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,44 @@ we define:
988988
before style recalc.
989989
</div>
990990

991+
<details class=note>
992+
<summary>Implied restrictions of scroll adjustment</summary>
993+
994+
In short: a positioned element
995+
is able to have its <em>position</em>
996+
rely on a scrollable anchor in a different scroll container,
997+
but cannot have its <em>size</em> depend on that.
998+
This restriction allows "composited scrolling" to continue to be used,
999+
where the actual shifting of a scrollable element's contents
1000+
is done in a separate "compositing thread" in the UA,
1001+
and the rest of the CSS
1002+
(in particular, layout)
1003+
can't directly depend on its results.
1004+
1005+
This is why only <em>one</em> anchor
1006+
(the [=default anchor element=])
1007+
is used for scroll adjustment--
1008+
if multiple anchors could be adjusted for,
1009+
then a positioned element could use different ones for opposite sides,
1010+
and trigger layout as a result of either of them scrolling.
1011+
1012+
Position fallback *can* end up depending on scroll adjustment,
1013+
which can cause re-layout
1014+
since the [=sizing properties=] are [=accepted @position-try properties=].
1015+
However, it's acceptable for fallback due to scrolling
1016+
to happen <em>a frame late</em>,
1017+
after the UA has had time to receive scrolling information
1018+
from the compositing thread.
1019+
This is not the case for simple position tracking--
1020+
if the positioned element is meant to sit snug against the anchor,
1021+
having it lag a frame behind is very user-visible,
1022+
and a pretty bad experience.
1023+
1024+
If you want to have a positioned element's size
1025+
depend on an anchor's scroll position,
1026+
the positioned element must be inside of the same scroll container,
1027+
so the two elements are never scrolled relative to each other at all.
1028+
</div>
9911029

9921030
Validity {#anchor-valid}
9931031
--------

0 commit comments

Comments
 (0)