Re: [csswg-drafts] [css-anchor-1] More declarative syntax for simple cases (#7757)

> What happens when we use anchor(auto) in a @position-fallback list?

I defined it in a later commit - it just selects the appropriate side as normal, but doesn't insert any entries. This seemed like the simplest behavior, and if you're already writing a fallback list, you can just write your fallback cases; the point of this is to let you avoid writing a fallback list entirely. But I'd be willing to make a change if necessary.

> If the anchor(auto) is invalid (i.e. the other side is not auto), does it still add entries to the position fallback list?

It shouldn't, yeah. I meant the current text to express that, but I see I didn't properly hook things to the validity of the automatic anchor positioning. If you don't use the value correctly *none* of the effects should trigger, and it'll just be an invalid anchor function. I'll tweak to fix.

> It doesn't work with how position fallback currently works. Currently, if an element uses position-fallback, then we never try to layout the element with its base (computed) style -- we start directly with the first fallback position.

...huh, I thought that I wrote it to start with the base styles and only do the position-fallback if it fails from the start. But reading it again, you're right, we do indeed just jump straight into the fallback list. And on consideration, that's almost certainly the most sensible behavior anyway.

So yeah, I'll need to add the base styles in. And also I probably want to change how this interacts with an existing fallback list - most likely I want to change it to *only* add entries if there is no list (for the same reason we don't add the base styles to the fallback list already). So you can *either* use auto positioning *or* use position-fallback, not both.

That then also makes me feel better about doing what you suggested about using it *in* a fallback list, where it adds 1-3 extra entries after itself. That way you can do some simple flipping *followed by* something more complicated as a last resort.

----------

So in summary:

1. I'll change it so that when used in a fallback list, it expands into 2 or 4 entries.
2. I'll make it clear that all the behavior is contingent on using it correctly - if the opposite property isn't auto, it's invalid and does nothing.
3. I'll make its use in normal styles *only* do something when there is no fallback list; if you already have a fallback list the base styles are ignored as normal.

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


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

Received on Wednesday, 1 February 2023 23:49:03 UTC