- From: Jonathan Watt via GitHub <sysbot+gh@w3.org>
- Date: Sun, 13 Oct 2024 17:19:12 +0000
- To: public-css-archive@w3.org
jwatt has just created a new issue for https://github.com/w3c/csswg-drafts:
== [css-anchor-position] The "acceptable anchor" algo seems broken ==
The [acceptable anchor](https://drafts.csswg.org/css-anchor-position-1/#acceptable-anchor-element) text contains the following:
>- possible anchor is painted strictly before positioned el, aka one of the following is true:
> - (snip)
> - Both elements are [in the same top layer](https://drafts.csswg.org/css-position-4/#in-the-same-top-layer) but have different [containing blocks](https://drafts.csswg.org/css-display-4/#containing-block), and positioned el’s containing block is an ancestor of possible anchor’s containing block in the [containing block chain](https://drafts.csswg.org/css-display-4/#containing-block-chain), aka one of the following:
> - positioned el’s [containing block](https://drafts.csswg.org/css-display-4/#containing-block) is the viewport, and possible anchor’s containing block isn’t.
> - positioned el’s [containing block](https://drafts.csswg.org/css-display-4/#containing-block) is the [initial containing block](https://drafts.csswg.org/css-display-4/#initial-containing-block), and possible anchor’s containing block is generated by an element,
> - both elements' [containing blocks](https://drafts.csswg.org/css-display-4/#containing-block) are generated by elements, and positioned el’s containing block is an ancestor in the [flat tree](https://drafts.csswg.org/css-scoping-1/#flat-tree) to that of possible anchor’s containing block.
I don't think some of these cases are correct.
For example:
> - positioned el’s [containing block](https://drafts.csswg.org/css-display-4/#containing-block) is the [initial containing block](https://drafts.csswg.org/css-display-4/#initial-containing-block), and possible anchor’s containing block is generated by an element,
seems to say that this should work:
```
<body>
<div class="anchored" style="position: absolute;"></div>
<div style="position: absolute;">
<div class="anchor"></div>
</div>
</body>
```
And:
> - both elements' [containing blocks](https://drafts.csswg.org/css-display-4/#containing-block) are generated by elements, and positioned el’s containing block is an ancestor in the [flat tree](https://drafts.csswg.org/css-scoping-1/#flat-tree) to that of possible anchor’s containing block.
seems to say that this should work:
```
<body>
<div style="position: absolute;">
<div class="anchored" style="position: absolute;"></div>
<div style="position: absolute;">
<div class="anchor"></div>
</div>
</div>
</body>
```
In other words, in these two cases we sometimes still require that "`possible anchor` is earlier in [flat tree](https://drafts.csswg.org/css-scoping-1/#flat-tree) order than `positioned el`."
This seems...hard to spec.
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11030 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Sunday, 13 October 2024 17:19:13 UTC