[csswg-drafts] [css-align-3][css-position-3] Better interaction of auto insets and self-alignment properties? (#9124)

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

== [css-align-3][css-position-3] Better interaction of auto insets and self-alignment properties? ==
Currently, the self-alignment properties (justify-self, align-self) are defined to position the abspos within its inset-modified containing block.

Separately, `auto` insets have varied behavior:
* If both insets are auto, the box doesn't use abspos alignment at all in that axis; instead it uses its static position, and *that* is specified to pay attention to the alignment properties.
* If only one inset is auto, it automatically computes so that the element's width + both insets fill the abspos containing block exactly.

Neither of these behaviors work nicely with the self-alignment properties! 
* Aligning the static position means you align in whatever box we happened to define for the static positioning rectangle, which is generally pretty arbitrary. (For example, in Grid it's just the content box of the grid container.) It feels unintuitive that this isn't just the inset-modified containing block that the abspos would otherwise be aligning in.
* Auto-computing the auto inset, on the other hand, just leaves the abspos with no free space to align it at all! It's completely useless!

In either case, you can recover useful behavior by explicitly setting the inset to 0 (or another value, if something else is more appropriate). But that's not the initial value, so it requires extra work on the author's side (and more importantly, requires them to know that there is work to do in the first place!).

I suggest that, when a self-alignment property is set to a non-`auto` value, we compute `auto` insets in that axis to 0, rather than using the normal auto-resolution rules. This will allow authors to use the self-alignment properties immediately, in what I believe is a more intuitive manner.

(We can't change the default behavior of abspos for long-standing compat reasons, so when the self-alignment properties are their initial value, `auto`, we have to leave the existing auto-insets behavior alone.)

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


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

Received on Friday, 28 July 2023 21:42:42 UTC