- From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
- Date: Wed, 03 Apr 2024 23:53:00 +0000
- To: public-css-archive@w3.org
> Is an anchor valid or visible if > * it has display: none, > * it's under content-visibility: hidden, or > * it's under content-visibility: auto and is currently not rendered. None of those are valid; they all fail to be [acceptable anchor elements](https://drafts.csswg.org/css-anchor-position/#acceptable-anchor-element), so an anchor function that would only be referencing those is not a [valid anchor function](https://drafts.csswg.org/css-anchor-position/#anchor-valid), because finding the target anchor element returns nothing. > For example, is border-width: anchor(--a top) an invalid anchor reference or should it be ignored? This also fails to be a [valid anchor function](https://drafts.csswg.org/css-anchor-position/#anchor-valid), and thus is ignored. > should we check the validity of anchor references from unused @position-try styles? No, only the styles actually being used should be considered. > should an anchor reference with missing default anchor (e.g. width: anchor-size(width) without a default anchor) be treated as invalid or be ignored? That's similarly not a [valid anchor function](https://drafts.csswg.org/css-anchor-position/#anchor-valid), because finding the [target anchor element](https://drafts.csswg.org/css-anchor-position/#target-anchor-element) returns nothing. > should we check the validity of anchor references from anchor-size()? Hmmmmm. I initially thought yes, it should match anchor(), but on further consideration I think it's reasonable to *not* check those. The whole point of the hiding behavior is to allow an element that's positioning relative to an anchor to not hover over a nonsense position when the anchor is outside the scrollport, but *sizing* is different. Being able to match the size of an anchor even before the anchor is visible seems reasonable, and virtually every use-case I can think of is *also* going to be using anchor() anyway. Whatever cases exist where you want to match an anchor's size without caring about the anchor's position *at all*, I suspect those probably *want* to be visible regardless. Worst case, you can always smuggle in an explicit anchor() to trigger the hiding behavior. (Change your `top: 20px;` to `top: calc(20px + anchor(--foo)*0);` to get identical behavior but with an anchor reference.) > actually we are also considering a different interpretation for anchors-valid and anchors-visible: I think what you're describing here matches the answers I provided above? It sounds to me like you're just reiterating the basic behavior that was already described, but I assume since you were asking the previous questions y'all were starting from a slightly different idea of what the behavior was supposed to be. Assuming this is the case, it looks like y'all are settling on exactly what I'm already intending to write into the spec. ^_^ > Should anchored check visibility of all anchors in the anchor chain? I think not. Your "simple interpretation" seems correct to me - while you can end up *indirectly* depending on the first abspos's anchors (if that abspos also uses position-visibility), your direct dependencies should only be the anchors you're explicitly using. -- GitHub Notification of comment by tabatkins Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7758#issuecomment-2035821112 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 3 April 2024 23:53:01 UTC