Skip to content

[css-contain] Can we allow absolutely positioned elements to escape a container? #10102

Closed
@mirisuzanne

Description

@mirisuzanne

I'm splitting this out from #10040, where we resolved that anchor-name is able to escape containment. That helps authors position elements in relation to contained anchors. But it doesn't help with the inverse: absolutely positioned elements inside a container cannot be anchored to anything outside the container.

This mirrors a common footgun with container queries. The container (layout containment) generates a fixed positioning context, so position-fixed elements are fixed to the container rather than the viewport.

If there is any way to loosen that requirement for container queries, it would remove the footgun and also allow more fluid interaction between container queries and anchor positioning.

I'm not entirely clear why this fixed-positioning context restriction is useful for container query implementations. I would have expected the (already resolved) counter example to be more problematic - since generally we don't want external layouts relying on container internals. In this case we only want internal layout to rely on external context - which is already the case. But maybe my mental model is wrong here?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    To do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions