Re: [csswg-drafts] [css-transitions] Transition to height (or width) "auto" (#626)

> Hmm, we could, but I'm not super confident it would be a net win in readability. It's already a little tricky to explain the behavior different between calc-size(50%, size) and calc-size(any, 50%); allowing it to be written with a single argument (calc-size(50%)) would, I'd be afraid, just complicate matters further.

Okay, giving this a bit more thought, because I *do* agree that for most cases you're having to supply a placeholder argument and that's kinda annoying; generally, only the intermediate transitioning states actually use both arguments non-trivially.

What if: you can pass a single argument to calc-size(), and whether it's treated as the first (basis) or second (calculation) depends on what kind of value it is? If it's an intrinsic-size keyword, it acts like the first argument, defaulting the second argument to `size`; if it's a length-percentage, it acts like the second argument, defaulting the first argument to `any`.

So you could transition from `calc-size(auto)` to `calc-size(0px)`, and it would be equivalent to writing `calc-size(auto, size)` and `calc-size(any, 0px)`, which gives you the right interpolation behavior.

The only downside is that if you specifically want to depend on a cyclic percentage, just writing `calc-size(50%)` won't work - it'll be equivalent to `calc-size(any, 50%)` and will resolve to 0 when the % is cyclic. You have to manually write `calc-size(50%, auto)`. But I suspect the much more common case will be transitioning to a *non-cyclic* percentage, which this'll work for - going from `auto` to `100%` (resolved against a definite size) works just fine with `calc-size(auto)` and `calc-size(100%)`.

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


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

Received on Thursday, 28 December 2023 01:00:07 UTC