w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.36k stars 641 forks source link

[css-anchor-position] position-visibility initial value should be `always`, not `anchors-visible` ? #10425

Open chrisdavidmills opened 4 weeks ago

chrisdavidmills commented 4 weeks ago

When writing MDN docs for anchor positioning, I was a bit confused by position-visibility — the spec says "initial value" is anchors-visible, but surely it should be always?

From testing:

My demo illustrates the behavior of the currently-supported values, in case that is helpful.

tabatkins commented 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.

chrisdavidmills commented 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.

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.