-
Notifications
You must be signed in to change notification settings - Fork 757
Description
When reviewing some incorrect testcases about the interaction of anchor positioning and scroll containers, and also the considering #10861, Tab and I concluded that there are multiple behaviors that are needed when attaching an abspos to a scrollable containing block, and we should introduce a switch. (Ian and Tab also came to this conclusion in a different discussion.)
The three possible behaviors for a scrollable containing block are:
- attach to the scrollport, do not scroll with the content ("outside" the scroller)
- attach to the "initial containing block" (coinciding with the scrollport at the initial scroll position), scroll with the content ("inside" the scroller)
- attach to the "scrollable containing block" (roughly the scrollable overflow area), scroll with the content
Our proposal is to split positioning into three controls:
position-type: static | relative | sticky | absoluteposition-attachment: auto | local | fixed | scrollposition-container: nearest | farthest | <custom-ident>
The position-container property was introduced in #9868
The position-attachment values are as follows:
local- the "initial containing block" of the scroller, the ICB at the rootfixed- the fixed scrollport itself, the viewport at the root.scroll- the scrollable overflow area, per [css-align][css-position][css-anchor-position] Introduce "document containing block" for some purposes? #10861auto-scrollif using anchor positioning orlocalotherwise (for compat)
position would accept <'position-type'> || <'position-attachment'> || <'position-container'> and resolve as follows (setting omitted values to initial):
static->position-type: staticsticky->position-type: stickyrelative->position-type: relativeabsolute->position-type: absolute; position-container: nearest; position-attachment: autofixed->position-type: absolute; position-container: farthest; position-attachment: fixed
For compat reasons, position-container: farthest; position-attachment: fixed may need to convert to local attachment if intercepted by a CB before the root (but it would be nice if we could not do this).
Doing this nicely will require shorthandifying position, though, so that's a topic we really do need to figure out. Working around it would be... awful.
Metadata
Metadata
Assignees
Type
Projects
Status
Status