Re: [csswg-drafts] [css-anchor-position-1] Allow having a snapshotted scroll offset without using `anchor()` (#9239)

> Having a valid default anchor without actually positioning it against the anchor is a weird/incorrect usage. I don't see much value guarding against such usage

I don't quite agree. A final fallback might reasonably be to just position in screen space, for example, without reference to any anchor at all, or position relative to a different anchor. Having the element still get shifted to match the scroll offset of the default anchor element seems weird/bad, and `anchor-default` isn't settable from the fallback styles so the author wouldn't have any way to stop that from happening.

That said, I sympathize with the "complicated to check", and you're right that anchor-center positions relative to the anchor without any anchor() functions at all, so *something* definitely has to change.

* The minimal change is to just generalize the condition to check for the element referring to the default anchor element in any way (either via anchor() or via anchor-center alignment, or any future ways we add).
* I'd be okay with removing the check entirely and making it always apply *if* there was a way for the author to opt out of it. I think allowing `anchor-default` to be set in fallback styles should be just fine, since it's (almost) identical to just specifying that anchor explicitly in each function. (There's just a few things that only look at the default anchor and don't otherwise have a way to specify what that is, like anchor-center.) (And actually allowing anchor-default to change in fallbacks would actually be good for things like anchor-center, so you could center on a different element. It's weird that, right now, you can't do that.)

------

In conclusion, yeah I'm totally fine with dropping the condition *if* we also allow anchor-default to be set in fallback styles.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9239#issuecomment-1693973387 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 25 August 2023 21:53:15 UTC