[csswg-drafts] [css-anchor-position] `anchor()` definition says it uses initial scroll positions, but "Taking Scroll Into Account" does not. (#12058)

dshin-moz has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-anchor-position] `anchor()` definition says it uses initial scroll positions, but "Taking Scroll Into Account" does not. ==
In the [definition](https://drafts.csswg.org/css-anchor-position-1/#anchor-pos) of `anchor()`: 

> An [anchor()](https://drafts.csswg.org/css-anchor-position-1/#funcdef-anchor) function representing a [valid anchor function](https://drafts.csswg.org/css-anchor-position-1/#valid-anchor-function) resolves at [computed value](https://drafts.csswg.org/css-cascade-5/#computed-value) time (using [style & layout interleaving](https://drafts.csswg.org/css-anchor-position-1/#style--layout-interleave)) to the [<length>](https://drafts.csswg.org/css-values-4/#length-value) that would align the edge of the positioned boxes' [inset-modified containing block](https://drafts.csswg.org/css-position-3/#inset-modified-containing-block) corresponding to the property the function appears in with the specified border edge of the [target anchor element](https://drafts.csswg.org/css-anchor-position-1/#target-anchor-element), assuming that all [scroll containers](https://drafts.csswg.org/css-overflow-3/#scroll-container) between the target anchor element and the positioned box’s [containing block](https://drafts.csswg.org/css-display-4/#containing-block) are **scrolled to their initial scroll position** (but see [§ 3.4 Taking Scroll Into Account](https://drafts.csswg.org/css-anchor-position-1/#scroll)).

But then, in ["Taking Scroll Into Account"](https://drafts.csswg.org/css-anchor-position-1/#anchor-recalculation-point):

> All [anchor references](https://drafts.csswg.org/css-anchor-position-1/#anchor-reference) are calculated as if all [scroll containers](https://drafts.csswg.org/css-overflow-3/#scroll-container) were at their [initial scroll position](https://drafts.csswg.org/css-overflow-3/#initial-scroll-position), **and then have their associated [remembered scroll offset](https://drafts.csswg.org/css-anchor-position-1/#remembered-scroll-offset) added to them**.

Not far above, it says:

> When a positioned element is first displayed, or when it [changes fallbacks](https://drafts.csswg.org/css-anchor-position-1/#fallback), its position is correctly calculated according to the up-to-date position of all [anchor references](https://drafts.csswg.org/css-anchor-position-1/#anchor-reference).

So I'd think ultimately `anchor()` should reflect position of scrollers when it toggles in and out of `display: none` or fallback changes? Comment #10999 seems to match this as well.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12058 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 8 April 2025 13:43:08 UTC