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

> The rationale seems to revolve entirely around implementation details, rather than author-facing usability, which is a bit of a design smell.

Sometimes that's unavoidable, yes. As I explained during the telcon (and at slightly greater length here in this issue), if you tried to bake it into calc() there's a number of problems:

1. Several cases would break backwards compat. (Eating compat on a direct "transition from `auto` to `0px`" sort of thing might be possible! We'd just have to actually do a study.)
2. A number of places in layout act differently based on whether a size is intrinsic or definite; you'd get a flicker of changed behavior at the endpoint when you transitioned from `auto` to `0px` and the value no longer contains anything intrinsic. (This is similar to how transitioning `opacity` from 0 to 1 suddenly triggers a change in stacking contexts at the end; for `opacity` you can get around that by transitioning to .999 instead, but I don't think expecting authors to transition to `calc(auto * .000001 + 10px)` is reasonable.)
3. Cyclic percentages are *fundamentally* unfixable; they have a simple and almost certainly depended-on-in-the-wild behavior already. No way around that; `calc(100%)` to `calc(0px)` must be `calc(50%)` in the middle, which is still cyclic and thus the same size as the starting point.
4. The validity rules around mixing keywords aren't really any simpler than the rules for when to use calc-size(). (You *can* use the same keyword multiple times, but not multiple different keywords, even if they behave the same.)
5. Where you can *use* a calc() with intrinsic keywords is also non-trivial. Two separate calcs() that are each *individually* valid (due to only using a single keyword) might combine into an invalid larger value `(hypot(calc(min-content), calc(max-content))`.

I *know* that it's really, *really* tempting to just go with "put keywords in calculations" to solve this problem. It's absolutely the obvious, cleanest solution! But I put a lot of thought into realizing why you *can't*, and wrote up those reasons in this issue.

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


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

Received on Tuesday, 26 December 2023 23:56:21 UTC