Skip to content

[css-anchor-1] Issues with position fallback #8059

Closed
@xiaochengh

Description

@xiaochengh

In a discussion with @bfgeek today we identified some issues about how position fallback is currently specified.

  1. For each fallback position, there should be an additional criterion that the margin box rect of the element (without scroll adjustments) should not overflow the inset-modified containing block. This is for some use cases (like below) where the element doesn't overflow the containing block, but instead overlaps with the anchor, which is still undesirable.
<style>
#anchor {
  anchor-name: --a;
  margin-left: 20px;
}
#anchored {
  position: fixed;
  top: anchor(--a top);
  width: min-content;
  position-fallback: --pf;
}
@position-fallback --pf {
  @try { left: 0; right: anchor(--a left); }
  @try { right: 0; left: anchor(--a right); }
}
</style>
<div id=anchor>anchor</div>
<div id=anchored>some very loooooooooooooooooooooooong content</div>
  1. We still need to make sure the scroll-shifted margin box doesn't overflow the original (not-inset-modified) containing block. But the spec isn't clear which box of the containing block to compare to: content, padding or border box? Content box makes the most sense to me.

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