[csswg-drafts] [css-anchor-position-1] Scroll adjustment doesn't work for chain of anchor-positioned elements (#9071)

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

== [css-anchor-position-1] Scroll adjustment doesn't work for chain of anchor-positioned elements ==
Consider a tree like
```
CB
+- scroller
|  +- anchor
+- abspos1
+- abspos2
```
where `abspos1` is anchored to `anchor`, and `abspos2` is anchored to `abspos1`

(test case available at https://jsfiddle.net/b1ycnpvL/)

When scrolling the scroller, the desired behavior is that both abspos elements should move. But currently only `abspos1` moves.

This is because the current spec only considers scroll offsets applied directly by scrollers between `CB` and the anchor, then the [snapshotted scroll offset](https://drafts.csswg.org/css-anchor-position-1/#snapshotted-scroll-offset) for `abspos2` is 0, which means there's no adjustment.

This issue is similar to #8448 that it's caused by non-scroll translations applied to the anchor. This issue, however, seems more severe because it breaks nested menus.

The proper fix is probably by making [snapshotted scroll offset](https://drafts.csswg.org/css-anchor-position-1/#snapshotted-scroll-offset) taking more offsets into account, including sticky position offsets and anchor position offsets applied to all ancestors of the anchor, all the way until the CB (exclusively).

The name "snapshotted scroll offset" still seems appropriate, though, because the extra offsets are still caused by scrolling.

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


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

Received on Saturday, 15 July 2023 00:35:31 UTC