Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

ngAnimate - Incorrect detection of transition end (too early / never) #4028

Closed
mik01aj opened this issue Sep 17, 2013 · 8 comments
Closed

ngAnimate - Incorrect detection of transition end (too early / never) #4028

mik01aj opened this issue Sep 17, 2013 · 8 comments

Comments

@mik01aj
Copy link

mik01aj commented Sep 17, 2013

See example: http://plnkr.co/edit/jYpCeL?p=preview

The div should have 1s transition on width and then 1s transition on background. In the example, only the first transition works. Perhaps Angular reacts to the transitionend event too quickly?

I'm using version v1.2.0-4aa9d2a (the latest master). Tested on Chrome 31 and Firefox 23 on Linux.

@mik01aj
Copy link
Author

mik01aj commented Sep 17, 2013

another example: http://plnkr.co/edit/dGUDfnDf8T2FljJZKTjl?p=preview - here the transitionend event is never fired, and ngAnimate thinks that transitions last forever. This is really nasty when used within ng-repeat - this prevents element removal (element has classes ng-leave ng-leave-active and stays there forever).

@mgol
Copy link
Member

mgol commented Sep 17, 2013

This is a really nasty bug, IMO it should be fixed for rc3.

@krsreenatha
Copy link

yep .......

@ghost ghost assigned matsko Sep 18, 2013
@mik01aj
Copy link
Author

mik01aj commented Sep 23, 2013

Hmm, I just noticed that my both link to plunks point to the same one, so I updated the first one (in issue description). You're welcome to have a look :)

@matsko
Copy link
Contributor

matsko commented Sep 25, 2013

Looks like it's working now:

https://s3.amazonaws.com/angularjs-dev/animation-delay-fix/example/broken.html

Here's the PR:

#4150

@mik01aj
Copy link
Author

mik01aj commented Sep 25, 2013

@matsko , does it address also the issue demonstrated by the second example (waiting forever for transition end)?

@matsko
Copy link
Contributor

matsko commented Sep 25, 2013

@mik01aj that's expected. Although the error should be properly handled. What goes on is that ngAnimate forcefully skips the first transition CSS class (in this case -add and -remove) and then sets the events while the 2nd class is added (in this case -add-active and -remove-active). This way the first class CSS styles are always applied instantly and the next styles are always animated. This means that you'll never get any transition events for when the first CSS class is added. And no transition behaviour will occur unless there are any styles present in the active class (therefore no events).

The only solution to capture the error is to use a $timeout to guard the entire animation. But timeouts suffer from when the browser takes too long to prepare an animation and using timeouts again in the code would ruin the tests. So we can't do that. There may be a solution regarding the transitionProperty fix that was placed back when ngClass was having bugs: 36ad40b#L0R624 but this will need to wait for the time being.

matsko added a commit to matsko/angular.js that referenced this issue Sep 25, 2013
@matsko matsko closed this as completed in 0a63adc Sep 26, 2013
@matsko
Copy link
Contributor

matsko commented Sep 30, 2013

@mik01aj I'm happy to focus on fixing the issue that you found out in your example in another issue, but let's leave this one as is for now so that 1.2 can get released earlier :)

jamesdaily pushed a commit to jamesdaily/angular.js that referenced this issue Jan 27, 2014
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this issue Jan 27, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.