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

I've written a polyfill which converts the `max-height` + `overflow:hidden` hack-around for this issue into a more precise `height` transition.  https://github.com/eoghanmurray/height-transition-polyfill

The basic idea is to measure the height at the start of the transition and assign it via style attribute. For the reverse transition from 0px to auto, because of the `overflow:hidden`, the `scrollHeight` attribute gives a good approximation of a target height for transitioning. (all these extras are removed after transition completes).

Transitioning from/to `auto` doesn't appear to cause any performance or other difficulties for the `overflow:hidden` case, as the internal element layout doesn't need to be recalculated (so e.g. height can't affect width).

I believe this special case (transitioning width/height with overflow:hidden to/from auto) represents 95% of the usecases [citation needed!], and should be a lot simpler to implement/standardize vs. the more general to/from auto/max-content.  Is there an argument to be made for focusing on this first? (i.e. wish this case was standardized 10 years ago!)

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

Received on Tuesday, 19 November 2019 11:04:34 UTC