Skip to content

Element.animate can return null in Chromium browsers #64486

@10kc-emilyk

Description

@10kc-emilyk

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

animations

Is this a regression?

No

Description

Sometimes, the Element.animate api can return null in chromium browsers (and throw in Firefox).

It affects anything that uses the result of _triggerWebAnimation

While haven't seen this bug in action directly, only in our error reporting system, it's concerning as it has the potential to crash an angular app. It has been reported to other frameworks, specifically here: microsoft/fluentui#33902 , and it is out-of-spec behaviour from the browser. It could be mitigated by

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

TypeError: Cannot read properties of null (reading 'addEventListener')
    at onFinish(node_modules/@angular/animations/fesm2022/browser.mjs:3566:19)
    at play(node_modules/@angular/animations/fesm2022/browser.mjs:3605:9)
    at play(node_modules/@angular/animations/fesm2022/browser.mjs:3154:33)
    at players.filter(node_modules/@angular/animations/fesm2022/browser.mjs:2956:13)
    at players.filter(node_modules/@angular/animations/fesm2022/browser.mjs:2949:16)
    at addClass(node_modules/@angular/animations/fesm2022/browser.mjs:2579:23)
    at flush(node_modules/@angular/animations/fesm2022/browser.mjs:3399:27)
    at end(node_modules/@angular/animations/fesm2022/browser.mjs:4032:20)
    at invoke(node_modules/zone.js/fesm2015/zone.js:369:157)
    at run(node_modules/zone.js/fesm2015/zone.js:111:36)
    at runOutsideAngular(node_modules/@angular/core/fesm2022/core.mjs:6310:23)
    at end(node_modules/@angular/animations/fesm2022/browser.mjs:4030:17)
    at handleError$1(node_modules/@angular/core/fesm2022/core.mjs:13612:28)
    at requiresRefreshOrTraversal(node_modules/@angular/core/fesm2022/core.mjs:23347:2)
    at Boolean(node_modules/@angular/core/fesm2022/core.mjs:23172:10)
    at this._injector.get(node_modules/@angular/core/fesm2022/core.mjs:23141:13)
    at warnIfDestroyed(node_modules/@angular/core/fesm2022/core.mjs:23110:13)
    at profiler(node_modules/@angular/core/fesm2022/core.mjs:23099:13)
    at tick(node_modules/@angular/core/fesm2022/core.mjs:23088:11)
    at next:(node_modules/@angular/core/fesm2022/core.mjs:34015:32)
    at invoke(node_modules/zone.js/fesm2015/zone.js:369:157)
    at onInvoke(node_modules/@angular/core/fesm2022/core.mjs:6414:24)
    at invoke(node_modules/zone.js/fesm2015/zone.js:369:45)
    at run(node_modules/zone.js/fesm2015/zone.js:111:36)
    at run(node_modules/@angular/core/fesm2022/core.mjs:6266:23)
    at next:(node_modules/@angular/core/fesm2022/core.mjs:34014:20)
    at next(node_modules/rxjs/dist/esm/internal/Subscriber.js:87:24)
    at _next(node_modules/rxjs/dist/esm/internal/Subscriber.js:56:21)
    at next(node_modules/rxjs/dist/esm/internal/Subscriber.js:29:11)
    at Array.from(node_modules/rxjs/dist/esm/internal/Subject.js:35:21)
    at cb(node_modules/rxjs/dist/esm/internal/util/errorContext.js:24:4)
    at next(node_modules/rxjs/dist/esm/internal/Subject.js:28:6)
    at emit(node_modules/@angular/core/fesm2022/core.mjs:5950:12)
    at checkStable(node_modules/@angular/core/fesm2022/core.mjs:6333:28)
    at delegate.hasTask(node_modules/@angular/core/fesm2022/core.mjs:6440:10)
    at hasTask(node_modules/zone.js/fesm2015/zone.js:412:43)
    at Error(node_modules/zone.js/fesm2015/zone.js:431:13)
    at _updateTaskCount(node_modules/zone.js/fesm2015/zone.js:259:27)
    at this._zoneDelegate.handleError(node_modules/zone.js/fesm2015/zone.js:179:19)
    at drainMicroTaskQueue(node_modules/zone.js/fesm2015/zone.js:567:22)

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

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 19.2.16
Node: 22.19.0
Package Manager: npm 10.9.3
OS: darwin arm64

Angular: 19.2.15
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, platform-server, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1902.16
@angular-devkit/build-angular   19.2.16
@angular-devkit/core            19.2.16
@angular-devkit/schematics      19.2.16
@angular/cdk                    19.2.19
@angular/cli                    19.2.16
@angular/material               19.2.19
@schematics/angular             19.2.16
rxjs                            7.8.1
typescript                      5.8.3

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions