-
Notifications
You must be signed in to change notification settings - Fork 757
Description
In #12552 (comment), we resolved that, if you have a "default anchor element", and your CB-generating element is a scroller, you use the “scrollable containing block” (aka the size of the scroller's entire contents) rather than the “local containing block” (the size of the scrollport, like the ICB). This allows multiple anchor-related features to work better wrt overflow alignment and position-try fallback, as the local CB is nonsensical to use for anything that starts out “below the fold”.
However, this creates both backwards-compatibility and forwards-compatibility issues because it changes the positioning of abspos boxes that have an implicit anchor, whether or not they are using anchor-positioning features.
- It would cause us to change where boxes with, for example,
bottom:0orright:0are placed if they are currently defined to have an implicit anchor (e.g. are a) popovers or b)::beforeor::after). - It would create this same Web-compat issue for adding an implicit anchor relationship in the future to any other already-existing elements.
After discussing how to work around this, Tab and I have the following proposal:
- Revert the resolution to make the scrollable CB key off of just whether or not there is a default anchor. Instead, key it off of having a default anchor and using
position-areaoranchor-center. This ensures that these features work as expected. - Keep using the local containing block for all other abspos boxes and for resolving their insets, but redefine
autoto calculate the inset-modified CB edge to match the corresponding scrollable CB edge. This ensures that positioning setting one inset withanchor()and leaving the otherauto(the common case) will get a useful CB for calculatingposition-tryoverflow, without changing the positioning behavior of any existing abspos usage that isn't usingposition-try.
We think this would preserve the existing behavior of abspos boxes while ensuring that positioning, alignment, and position-try fallback of anchor-positioned boxes behaves as expected, for position-area, anchor-center, and anchor(). (Thus, for the three cases given by the testcase in #12952, they would all still position over the --bottom anchor, as intended, neither triggering position-try fallback nor alignment-safety shifting.)
We might also consider, for abspos in general, making the “scrollable containing block” be the “original containing block” (while keeping the “containing block” as the “local containing block”), so that we only trigger overflow alignment safety against the “scrollable containing block”, where it is actually needed.
Thoughts?
Metadata
Metadata
Assignees
Type
Projects
Status