Skip to content

[css-anchor-position-1] Using a specific box (not your CB) to determine position-fallback #8724

@tabatkins

Description

@tabatkins

@una brought this case to our attention today: if you use abspos+anchor() to position an element, position fallback uses the abspos containing block (the nearest relpos ancestor) to tell if the positioned element is overflowing and should try a different position. But if you use fixpos or popover, which are otherwise strictly more powerful for anchor() purposes, you lose this ability - the CB is now the ICB, and you can't reference anything else.

The problem here is, partially, that the inset properties perform double duty - they adjust the size of the inset-modified containing block and position/size the element within the IMCB. Anchoring needs to use them for the latter, but position fallback still needs the former as well.

I suggest that we add a property allowing you to specify a particular anchor to use as your position-fallback overflow bounds, rather than your normal CB. Maybe:

position-fallback-bounds: normal | <<dashed-ident>>;

normal means to use your positioning CB, as specified today. Giving a dashed-ident performs anchor selection (same as what's required for anchor()), and uses the resulting element instead.

(In theory one might want to use different elements for each side, or slightly adjust the bounds inward or outward from the bounding element's edge. This grammar is extensible in the future to a four-edge version, if we'd like.)

/cc @xiaochengh

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions