A transition of width: auto to a fixed width computes auto as zero. See attached test case.
Created attachment 17321 [details] Testcase
This is tricky, since animation happens on RenderStyles, so a layout would actually be required in order to determine what the auto width value at the destination is going to be.
Adding Radar I filed a while back. <rdar://problem/5639997> transition fails when animating between different size units (e.g. px and %)
Created attachment 19236 [details] Test case from related Radar, includes both % and auto widths. Adding test case from related Radar, includes both % and auto widths.
*** Bug 18726 has been marked as a duplicate of this bug. ***
<rdar://problem/5639997>
Comment from Dave Hyatt on the w3-style list: This is right. In WebKit, we transition on the computed value of a property (not the specified value or used value). Note that there have been requests to transition on the used value instead, the most obvious example being wanting to transition from, e.g., width:100% to width:50px. If you transition on the computed value, then it's impossible to run an animation from width:auto to width:50px or from width:50% to width:80px, etc. The problem with transitioning on the used value, though, is it can change when your style hasn't.... if you resize a window that contains a width:auto or width:100% block for example. Obviously you don't want to run a transition in that case. My own preference would be (for simplicity) to just stick with transitioning on the computed value and to just say "Tough" to people who want to animate width this way, but maybe others disagree. We continue to get bugs in WebKit from confused people trying to animate auto widths to fixed values (or percents to fixed values) and not understanding why it doesn't work.
*** Bug 31957 has been marked as a duplicate of this bug. ***
How about we animate on the used value but only when the computed value changes?
Isn't the computed value internally kept as a pixel value no matter what the unit is? Wouldn't that mean that a change from width:80px to width:auto could do a non-transitioned lookup to see what pixel value "auto" currently computes to, and transition to that? I'm probably not understanding it, but it seems weird that every Javascript library in the world that does this has it figured out, but a hardware accelerated implementation can't?
> My own preference would be (for simplicity) to just stick with transitioning on the computed value and to just say "Tough" to people who want to animate width this way, but maybe others disagree. Many use cases for CSS transitions and animations include starting and ending at a computed value — showing and hiding content is a huge one. Also, treating computed values as zero is never going to be the right behavior. If this isn't going to be fixed, then trying to animate a computed property should kill the animation entirely.
I think not fixing this bug would be a grave mistake; this is the #1 use case for animation libraries used on the Web today, and thus, the #1 use case for the CSS Transitions implementation. And it is broken in CSS Transitions.
Dave Hyatt and I talked about how we might fix this. We'd have to do a layout at the start of the animation to compute the end state, but this might not work in some cases.
*** Bug 35816 has been marked as a duplicate of this bug. ***
*** Bug 52245 has been marked as a duplicate of this bug. ***
*** Bug 55137 has been marked as a duplicate of this bug. ***
Has there been any progress on this bug? Or are there alternate solutions that we could work towards?
*** Bug 65067 has been marked as a duplicate of this bug. ***
*** Bug 113871 has been marked as a duplicate of this bug. ***
The CSS WG has resolved that transitions don't run to/from auto values.
This resolution is very frustrating.
The web keeps disappointing. Are you browser devs really okay with that?
(In reply to comment #22) > The web keeps disappointing. Are you browser devs really okay with that? Please bring this up on www-style if you think it's important.