Open chrisdavidmills opened 4 weeks ago
The current impl in Chrome isn't reflecting the spec; it indeed is using "always" as the initial value. But the spec's text is intentional - if your anchor is off-screen or otherwise scrolled off, you usually want it to hide.
The current impl in Chrome isn't reflecting the spec; it indeed is using "always" as the initial value. But the spec's text is intentional - if your anchor is off-screen or otherwise scrolled off, you usually want it to hide.
Thanks @tabatkins, that makes sense. So as soon as an element becomes an anchor-positioned element, per spec it should adopt the anchors-visible
behavior?
The way we've currently written it reflects the current implementation, so I think it is OK to publish it like that for now. We'll just have to change it once behavior updates.
When writing MDN docs for anchor positioning, I was a bit confused by
position-visibility
— the spec says "initial value" isanchors-visible
, but surely it should bealways
?From testing:
position-visibility
value, an anchor-positioned element is always visible provided it is inside the viewport, regardless of the visibility of its anchor. This is the behavioralways
gives as well.anchors-visible
, on the other hand, causes an anchor-positioned element to be hidden if its anchor is not visible at all in the viewport.My demo illustrates the behavior of the currently-supported values, in case that is helpful.