Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
chrisdavidmills opened this issue Jun 11, 2024 · 2 comments
Labels
Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. css-anchor-position-1 Needs Testcase (WPT)

Comments

@chrisdavidmills
Copy link

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:

  • If you don't set a 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 behavior always 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.

@tabatkins
Copy link
Member

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
Copy link
Author

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.

@fantasai fantasai added Needs Testcase (WPT) Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. labels Aug 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. css-anchor-position-1 Needs Testcase (WPT)
Projects
None yet
Development

No branches or pull requests

3 participants