[csswg-drafts] [css-anchor-position] Including the base styles in the reorderable fallbacks (#10003)

tabatkins has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-anchor-position] Including the base styles in the reorderable fallbacks ==
`position-try-order` lets you reorder your `position-try-options` values according to which produces the largest IMCB in some axis. It is intentionally specified, tho, to only reorder the fallbacks themselves; it does *not* include the base styles in this list. That is, we always use the base styles *unless* they overflow, and only *then* do we look at the (possibly re-ordered) position fallback list.

In general this is what you want - the base styles specify the intended default, and the fallbacks are just what you use if you have to.  For example, `select` dropdowns always extend down if they fit, even if there's more space above than below.

But sometimes you don't actually care *where* your anchored element goes, you just want it in whatever space fits it best. Currently, you can hack this behavior by forcing the base styles to overflow (for example, setting `top: 0; bottom: 100%;`, which creates a zero-height IMCB), so the fallbacks will be immediately invoked. That's pretty silly, tho.

I propose that, instead, we allow `position-try-order` to specify this. Two possibilities:

* `[ <<try-size>> && [ fallbacks | all ]? ]` - that is, you can specify whether you're reordering just the fallbacks (the default) or all the styles (fallbacks + base)
* `[ <<try-size>> && skip-base? ]` - that is, you can specify that you skip the base styles and immediately proceed to using the fallbacks.

Either solution solves the problem. The first continues to play nicely with base styles; the second lets you move base styles into the fallback list and potentially deal with them as a package.

@fantasai and I prefer the first option. The fallbacks act a little weird anyway, re: the cascade, so we think we shouldn't be encouraging authors to put *more* styles into there.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10003 using your GitHub account


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

Received on Monday, 26 February 2024 22:12:04 UTC