[css-align][css-anchor-position] Default safety and fixpos · Issue #10860 · w3c/csswg-drafts (original) (raw)
[continuing from #10859]
An issue arises if the "original containing block" is the viewport. The position of this rect responds to scrolling, and thus anything that uses it must be aware of the compositor limitations. In particular, we can't actually respond to it at layout time, like we would normally do for alignment. It needs to be handled similarly to scroll adjustment in Anchor Pos, where we initially position it as if everything were at the initial scroll position, then shift it in the compositor thread to compensate for accumulated scroll offsets.
Specifically, then, if the element is using the viewport as its original CB (aka it's fixpos and nothing is intercepting it), it needs to always default to unsafe alignment, and then we handle the medium-safety as a scroll adjustment using wording similar to what's in Anchor Positioning.
The observable effect of this should be identical for users of the feature - the element shifts to stay on-screen if possible. It's just the actual definition that needs to change to be implementable.