Closed
Description
In a discussion with @bfgeek today we identified some issues about how position fallback is currently specified.
- 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>
- 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.