-
Notifications
You must be signed in to change notification settings - Fork 27.5k
ng-animate border-spacing causes slight jump when animating #5255
Comments
+1 |
+1 Also have seen this issue. |
Hey guys. So the .my-animation {
transition:1s linear all;
}
.my-animation.ng-enter {
opacity:1;
}
.my-animation.ng-enter.ng-enter-active {
opacity:0;
} This works fine, but since the transition is placed on the root CSS class, The ideal solution would be to scrap using an extra CSS property and instead use a global timeout that flushes all pending animations after X number of milliseconds after the total time of the transition has passed. The only issue is that it may cause an animation to end early since browsers sometimes start animations a few 100ms later. The main issue is that we would have to make the closing timeout to be very long and that wouldn't help close transitions as soon as the animation itself is done. For now, to get around the jumpy flicker, just put this in your code (use AngularJS 1.2.3): /* .container is the CSS class from the plunkr example.
Use that one or replace with the CSS class which contains
the element that is a table which will render the border-spacing */
.container.ng-animate-start,
.container.ng-animate-active {
border-spacing:none;
-ms-zoon:auto;
} |
@matsko thanks for the explanation, and code. |
Gotcha @matsko, makes sense; that would be a nasty bug to diagnose. Thanks for the info (and for all the work on ngAnimate btw, loving it).
Might happen often though, no? Tables are used often and the element being animated doesn't necessarily need to be a Not a huge issue though since we have both come up with some workarounds, but I could see it causing headaches for some developers in the future. |
Ahh, I didn't think border-spacing is inherited. Alright, I'll need to investigate to see if there is another property (which I doubt). One solution is to use This back and forth with checking for styles does make |
If a global timeout if what it takes to fix this I think that's what should be done. Once identified this issue is simple to fix by adding Animations are typically fast and then the artifacts of the increased border spacing shows up as nothing more but a quick but very nasty flicker. It furthermore makes it hard to use the HTML element inspection tools in browsers to figure out what's going wrong. It at least took me some time to debug the problem and figure out that AngularJS was adding border spacing. And this problem isn't only affecting people doing animations with elements containing tables. I'm using the Bootstrap grid system and here the border spacing also shows up (which further makes the debugging tricky since I'm not even using tables). |
@paldepind yeah it affects the Bootstrap grid system because the rows in the grid use clearfix (display:table). I don't know the original problem or source code well enough yet to declare whether or not a global timeout is the way to go but the current border-spacing solution clearly has a lot of negative effects. |
Yup. |
@matsko you're awesome. |
@matsko Sounds good! |
…y to close transitions With ngAnimate, CSS transitions, that are not properlty triggered, are forceably closed off by appling a fallback property. The fallback property approach works, however, its styling itself may effect CSS inheritance or cause the element to render improperly. Therefore, its best to stick to using a scheduled timeout to run sometime after the highest animation time has passed. Closes angular#5255
Special delivery: #5403 |
…y to close transitions With ngAnimate, CSS transitions, that are not properlty triggered, are forceably closed off by appling a fallback property. The fallback property approach works, however, its styling itself may effect CSS inheritance or cause the element to render improperly. Therefore, its best to stick to using a scheduled timeout to run sometime after the highest animation time has passed. Closes angular#5255
…y to close transitions With ngAnimate, CSS transitions, that are not properlty triggered, are forceably closed off by appling a fallback property. The fallback property approach works, however, its styling itself may effect CSS inheritance or cause the element to render improperly. Therefore, its best to stick to using a scheduled timeout to run sometime after the highest animation time has passed. Closes angular#5255 Closes angular#5241 Closes angular#5405
Awesome thanks for this @matsko |
…y to close transitions With ngAnimate, CSS transitions, that are not properlty triggered, are forceably closed off by appling a fallback property. The fallback property approach works, however, its styling itself may effect CSS inheritance or cause the element to render improperly. Therefore, its best to stick to using a scheduled timeout to run sometime after the highest animation time has passed. Closes angular#5255 Closes angular#5241 Closes angular#5405
…y to close transitions With ngAnimate, CSS transitions, that are not properlty triggered, are forceably closed off by appling a fallback property. The fallback property approach works, however, its styling itself may effect CSS inheritance or cause the element to render improperly. Therefore, its best to stick to using a scheduled timeout to run sometime after the highest animation time has passed. Closes angular#5255 Closes angular#5241 Closes angular#5405
…y to close transitions With ngAnimate, CSS transitions, that are not properlty triggered, are forceably closed off by appling a fallback property. The fallback property approach works, however, its styling itself may effect CSS inheritance or cause the element to render improperly. Therefore, its best to stick to using a scheduled timeout to run sometime after the highest animation time has passed. Closes angular#5255 Closes angular#5241 Closes angular#5405
While I was messing around with the ngAnimate module in the 1.2.3 release I noticed slight "jumps" in some of the elements I was animating, but not all of them. After some digging I realized that the jump in these particular elements was being caused by
border-spacing: 1px 1px
being applied to them during the animation. I created a small demo that demonstrates the behavior I was seeing:http://jsfiddle.net/47E8m/1/
After some googling, I came to this issue thread and then realized that the jumpy elements I had were all utilizing the clearfix hack which uses
display: table
.Without having to modify any of my other CSS, a quick workaround I found was to add the following to my CSS:
@matsko what's the nasty bug that makes
clip
orborder-spacing
necessary? Perhaps there's some other CSS properties we could try.The text was updated successfully, but these errors were encountered: