[csswg-drafts] [css-scroll-anchoring-1] the candidate examination algorithm visits absolutely positioned elements twice (#3465)

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

== [css-scroll-anchoring-1] the candidate examination algorithm visits absolutely positioned elements twice ==
The [candidate examination algorithm](https://drafts.csswg.org/css-scroll-anchoring/#candidate-examination) visits absolutely positioned elements twice.  First it does:

> 1. For each DOM child C of N, perform the candidate examination algorithm for C in S, and terminate if it selects an anchor node.

This step, at some depth of traversal, will reach absolutely positioned elements, unless `overflow-anchor` on an intermediate element is used to block that traversal.

Then it says:

> 2. For each absolutely-positioned element A whose containing block is N, but whose DOM parent is not N, perform the candidate examination algorithm for A in S, and terminate if it selects an anchor node.

This will find the same absolutely positioned elements already visited in (1).  So the only case where it seems like it could return something is if there's an `overflow-anchor: none` somewhere on the DOM path between the containing block and the absolutely positioned element.

This seems like it's probably unintentional, and perhaps that absolutely positioned elements were intended to be excluded from the regular DOM traversal -- maybe in all cases, or maybe only if the containing block is different from the parent.  (The results would be different, so it seems less weird to exclude them in all cases!)

It's also not clear to me why absolute positioning gets a different treatment from floating (where `overflow-anchor: none` on an intermediate inline, based on the spec, does apparently have an effect, although I didn't test in Chrome).

/cc @eqrion who is implementing this in Gecko.

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

Received on Friday, 21 December 2018 23:47:23 UTC