Skip to content

Element that is shown again before the leave animation completed is retained in the DOM #64581

@mattlewis92

Description

@mattlewis92

Which @angular/* package(s) are the source of the bug?

platform-browser

Is this a regression?

No

Description

If an element is hidden, then reshown, and hidden again before the first leave animation completes, then the element is retained in the DOM:

Image

The stackblitz contains a very contrived example, but was extracted from real world usage (an ngrx state change toggled a boolean value in quick succession which triggered this bug in our application)

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/stackblitz-starters-bvxfscx5?description=An%20angular-cli%20project%20based%20on%20@angular/animations,%20@angular/common,%20@angular/compiler,%20@angular/core,%20@angular/forms,%20@angular/platform-browser,%20@angular/platform-browser-dynamic,%20@angular/router,%20core-js,%20rxjs,%20tslib%20and%20zone.js&file=src%2Fmain.ts&template=node&title=Angular%20Starter

Please provide the exception or error you saw


Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 20.3.6
Node: 20.19.1
Package Manager: npm 10.8.2
OS: linux x64
    

Angular: 20.3.6
... animations, build, cli, common, compiler, compiler-cli, core
... forms, platform-browser, router

Package                      Version
------------------------------------
@angular-devkit/architect    0.2003.6
@angular-devkit/core         20.3.6
@angular-devkit/schematics   20.3.6
@schematics/angular          20.3.6
rxjs                         7.8.2
typescript                   5.9.3
zone.js                      0.15.1

Anything else?

This was previously working and broke in 20.2.3

Metadata

Metadata

Labels

area: coreIssues related to the framework runtimecore: animationsIssues related to `animate.enter` and `animate.leave`state: has PR

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions