Re: [csswg-drafts] [css-anchor-1] Ability to escape containment of other positioned elements (#8588)

> From the top of my head — potentially, the rules for the anchor acceptance could be different for a fixed element and an element inside a certain scope maybe?

Correct. The anchor has to be fully laid out before we start laying out the positioned element, and that is ensured by the "acceptable anchor" conditions. If the positioned element is fixpos, tho, that pretty much forces it to be laid out after the entire rest of the page, so the conditions are satisfied fairly trivially.

> I'm not entirely sure how/why [anchor-scroll] works the way it works in combination with position: fixed, and it works regardless of which anchor I provide (either --a or --b seem to work)

In short, anchor-scroll walks up the CB chain of both the anchor and the positioned element, noting any scrollers it encounters, and then takes into account the scroll offsets of each of them to shift the positioned element so it continues to track the anchor correctly. A fixpos isn't special here; it just happens to use the initial containing block (which is above all scrollers in the page), so it'll accumulate offsets from all scrollable ancestors of the anchor all the way to the root.

> What I would want in this example — to inner element to only skip the inner .wrapper, but not go outside of the top-most wrapper, allowing an element that is outside of everything to still being able to target that absolutely-positioned element.

This would be a more general abspos alteration, unrelated (directly, at least) to anchor positioning: reparenting the abspos in the box tree to a given ancestor containing block, rather than just choosing between the nearest (for abspos) or the initial containing block (for fixpos).

So, currently out of scope for Anchor Positioning, but within reason as a future feature for the Positioning spec.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8588#issuecomment-1470933387 using your GitHub account


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

Received on Wednesday, 15 March 2023 22:34:14 UTC