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

@laukstein / @Loirooriol: Good thoughts.

First of all, I would suggest to have transitions and animations always be based on the computed device pixels value, regardless of the CSS length currently being applicable to an element. Doing so, we get an abstraction layer from how a `width` or `height` is declared to what it really is.

Then, in the event of (a) content changing, (b) styles getting dynamically applied or (c) transitions/animations being triggered, I would - figuratively speaking - draw the page having transitions/animations disabled. Then I'd get the computed device pixels values for all elements having `auto` set for their `width` and `height` properties, and store those "target" device pixels values as shadow properties along with those elements. Next, I would re-enable transitions/animations and have them animate all elements whose current "in-transition" computed device pixels value deviate from the newly computed "target" device pixels value accordingly.

I once wrote a JavaScript function that works exactly like this (using hidden shadow elements, so running transitions on the target elements won't get interrupted) and it works like a charm.

@laukstein : Given my above explanation I would suggest to use the computed "target" device pixels value as a starting point for any initial transition/animation.

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

Received on Tuesday, 19 May 2020 20:41:03 UTC