-
Notifications
You must be signed in to change notification settings - Fork 27.4k
NgAnimate - Transition flickers on it's beginning when using NgClass and ng-animate class #16561
Comments
I believe the current behavior is intentional (although I am going to close this, since changing the behavior would be a breaking change (which not an option atm). |
I didn't posted my real question, because I thought it's not necessary since it's a clear bug in the library. Basically I have a situation when, using ngClass, I guess that's an exact scenario when As I tested a little bit more I found out everything is working when About this change being an breaking change:
Can anybody at least quickly introduce me to the library's code so I can try to fix this bug? |
As mentioned in my previous comment, I believe the current behavior is intentional; not a bug. The idea is that you can specify "base" styles (using I understand this will not be desirable in certain cases, but this is how it is implemented (and changing
Indeed it is not ideal, but still possible to define styles for all these classes. (There are other solutions available - keep reading 😃)
No, it is not (see above) 😁
This is because we use
Every coin has two sides 😃
@FRSgit, meet $animate, $animateCss, $animateRunner, and the rest of the crew. Kidding aside, this is not something we intend to change at this point 😁 As mentioned above, an easier/shorter fix (if you don't want to explicitly add a selector for each added class), would be to target Sorry for the long post 😳 |
Hey @gkalpak, thanks for long response, it was very useful to say at least! I have only one question, which don't have to be answered, but after searching the internet and checking out performance time by myself I cannot answer it by myself and want just to know (litte curious nerd here): I don't see the reason why As I checked in the console, there is no difference in time of code evaluation when adding/removing class with/without transition style set (at least no visible/measurable when adding classes on multiple elements at once). I guess somebody wanted to avoid any incoming transitions set on ngAnimate's initial classes (so I suppose on On the other hand, if somebody wants to have a transition there what's the problem with letting him to? As you see, in my scenario there is no good option to go using CSS (having class checking on |
Okay, just FYI @gkalpak, I finally got it working as expected with somehow-clear-solution - see plunker. Sorry, I completely forgot about I found out a one thing there - if you attach transition to Also, I still have the question - (which was elaborated above) what is the reason for this And as a last I want to improve docs a bit, so Thanks for your time & assistance! |
The negative delay is essentially disabling any animations/transitions that may apply to the element. This is because we want the styles associated with the
I am not sure this is true (e.g. if you use another class to differentiate the
If this fits your usecase, that's great. One thing to keep in mind though, is that
From a brief look, it does look unexpected. Could be a bug. I need to investigate more.
That would be awesome. You are more than welcome to do so 😃 |
Fortunately, it turns out everything works as intended 😌 .staticClass.ng-leave-active,
.staticClass.ng-enter:not(.ng-enter-active) {
opacity: 0;
} |
Well, that doesn't answer to question why at all, but I understand it's approach you choose (unfortunately breaking stuff from versions 1.4.0-) and want to stick with it just to have compatibility since 1.4.0.
Well, I'm not 100% sure about exact browser's implementations as well.
+1 from me on that!
Sure, look for me in pull requests - probably something will land till Friday 😃 |
Sorry, I misunderstood the question. The reason why we want to apply the styles associated with From my previous comment:
For example, you might have an element with |
As a result of angular#16561 - added ngAnimateSwap to `Which directives support animations?` table, so it's more visible.
`Which directives support animations?` section: Added info about ngAnimateSwap directive. Sorted table alphabetically, now it's the same order as appear in documentation's navigation. References angular#16561
Synced this table with one which appears in animations guide (docs/content/guide/animations.ngdoc). References angular#16561
Add a section which covers use case when user's need to animate upon every variable's value change. Refers angular#16561
@gkalpak Docs have been updated in two pull requests from me. I allowed myself to quote you directly in new section in ngAnimate module, hope you don't mind 😄
|
Awesome, I'll take a look asap.
You are welcome to take it on, but be warned that it won't be an easy undertaking 😃
Good question. I haven't thought everything through, but here are some off-the-top-of-my-head thoughts:
|
cc @Narretz (who is more experienced in |
Interesting. I haven't read everything, but as far as I can see @gkalpak has covered the implementation considerations. One questions. Why
Why shouldn't it apply to all class based animations? |
I think it will get too noisy. Besides, most animated classes are specific and easily targeted (e.g. |
…tion Add a section which covers use case when user's need to animate upon every variable's value change. Refers angular#16561
Reordered directives tables due to pull request's review (angular#16581) Refers angular#16561 Refers angular#16581
Actually I can think of use cases when you want to animate on every change of other "animatable directives" than ngClass (e.g. every ngModel's state change).
I agree with that. 2 more classes on every animation of every directive is not a small amount. However, we have to remember that there is the solution which allows to limit "noise" made by Also - there would be need to create new |
Reorder directives tables due to pull request's review (angular#16581) Unify under-the-table informations. Refers angular#16561 Refers angular#16581
…tion Add a section which covers use case when user's need to animate upon every variable's value change. Refers angular#16561
Add a section which covers use case when user's need to animate upon every variable's value change. Refers angular#16561
Ping |
I'd be more in favor of a general solution, i.e. apply the classes for every $animate.addClass etc. action. It's hard to say how big the perf impact is without an implementation, and since we are closing feature dev at the end of June the latest, there's really only a window of about 2 weeks here to implement and test this. If you want to go ahead with a basic implementation, we can take a look at it, but won't guarantee it'll actually make it. |
I'm submitting a ...
Current behavior:
When changing class with NgClass directive
transition
style seems to be overriden by something on animation start, so animation doesn't work when easing in, only when easing out (only when using ng-animate class to contain animation styling).Expected / new behavior:
Transition
style should be taken into account also when animation begins.Minimal reproduction of the problem with instructions:
latest snapshot - not working
1.6.9 (current stable version) - not working
1.4.0-rc.0 - not working
1.4.0-beta.6 - working
AngularJS version: Regression happened in 1.4.0-rc.0 and still exist (tested in latest snapshot - see above).
Browser: Firefox / Chrome / Opera / Edge (tested on Windows 10, but I believe it doesn't matter).
Anything else:
Something broke when refactoring code between 1.4.0-rc.0 and 1.4.0-beta.6. I tried to trace this issue but too many things was moved in the code for me to follow.
The text was updated successfully, but these errors were encountered: