New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Animations] :enter / :leave animations are triggered incorrectly for reordered items #40752
Comments
|
This is likely an issue with the Angular animations module. The same problem can be observed after removing all CDK drag&drop directives and changing the list using a button. Here's a forked example that shows the issue: https://stackblitz.com/edit/angular-3katn7-12d5fw?file=src%2Fapp%2Fcdk-drag-drop-custom-placeholder-example.html. I'll transfer this over to the Framework repo. |
|
Can this be related to the lack or a I tried adding one and it changes how thing play out (still not right but differently) With a the animation package likely doesn't know which element is being removed and just animated the last one as leaving (which makes sense I guess) I guess this could be updated to that it would detect which element is actually being removed, but then it would just "snap" the rest of the elements in place... right? doesn't seem the best either |
|
It seems that it is related to using the By manually recreating the moved object, it would be detected as a change by It's an acceptable workaround for my scenario, but it is not ideal. html template drop event |
|
Followup: By using the The below snippet will suppress the html: ts: |
|
I have what I assume is a related issue, but for my use case it's significantly more of an issue than a basic animation glitch. I have reorderable components that can be toggled between a view and edit state, with a (rather hacky) crossfade animation. After a component has been moved in the list, toggling into edit mode leaves a permanent non-interactive ghost of the view state. You can then move the component again, and repeat, ending up with the view state repeated multiple times. |
|
@jessicajaniuk What ever happened to this? It can be more serious than just a glitchy animation if it hits you. I came across a very similar issue to the one described by @stuartgibson above. I was able to demonstrate broken behavior even with just a simple opacity fade of elements inside the *ngFor item template (not :enter or :leave animation). Basically my conclusion is that is just isn't safe to use any kind of Angular animation inside a list that may get reordered. The current state of the item's animation is just not retained after the item is moved. I created a new issue #50861 |


Reproduction
I've created a fork of the CDK Drag&Drop custom placeholder example to demonstrate this bug:
https://stackblitz.com/edit/angular-3katn7?file=src/app/cdk-drag-drop-custom-placeholder-example.ts
Steps to reproduce:
:leaveanimation being triggered correctly:enteranimation being triggered instead of:leaveExpected Behavior
What behavior were you expecting to see?
The
:leaveanimation should be triggered correctly on any list item wether or not it has been repositioned due to drag & drop at some point in time.Environment
The text was updated successfully, but these errors were encountered: