question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular 14 unnecessarily warning about not animatable properties?

See original GitHub issue

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

animations

Is this a regression?

No

Description

It seems Angular 14 is warning about the presence of not animatable style attributes in a transition() call whether or not the implementation sets them as part of an animate() call.

In the following implementation, styles set in query(":enter, :leave") are preparation styles to be applied for the duration of the transition but are not set up to be animated. Still I get a warning about position and overflown not being animatable.

transition("* => fade", [
  style({ position: "relative" }),

  query(":enter, :leave", [style({
    position: "absolute",
    inset: "0 0 0 0",
    overflow: "hidden",
  })]),

  query(":enter", [style({ opacity: 0 })]),
  query(":leave", [animateChild()]),

  group([
    query(":enter", [animate("150ms ease-out", style({ opacity: 1 }))]),
    query(":leave", [animate("50ms", style({ opacity: 0 }))]),
    query("@*", [animateChild()]),
  ]),
]);

The animate() calls above are specific about which attributes are to be animated, so they are not trying to animate towards all the attributes of the destination state.

Am I wrong in my understanding of how transitions in Angular work or is the compiler being unnecessarily critic in the new version?

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

The animation trigger "ngxRouterAnimation" has built with the following warnings:
 - The following provided properties are not animatable: position, overflow
   (see: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animated_properties)

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

Angular CLI: 14.0.2
Node: 16.15.1
Package Manager: pnpm 7.3.0 
OS: linux x64

Angular: 14.0.3
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, material, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1400.2
@angular-devkit/build-angular   14.0.2
@angular-devkit/core            14.0.2
@angular-devkit/schematics      14.0.2
@angular/cli                    14.0.2
@schematics/angular             14.0.2
ng-packagr                      14.0.2
rxjs                            7.5.5
typescript                      4.7.4
webpack                         5.73.0

Anything else?

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
dario-piotrowiczcommented, Jul 1, 2022

@diegovilar I implemented the check for actually providing the warning only if the animation is trying to animate them

As you can see here, it does the trick (I copied your animations code but I applied a random html to it since you didn’t provide one): before after

It has the drawback to be run when you play the animation instead of at build time, so you get the warning each time the animation runs instead of just when the component gets generated. This makes sense from the implementation point of view because it makes it easy to check if for an animation a non-animatable property is going to be animated. Hopefully it’s not too bad? I guess we shall see what reviewers say on the PR 😃

Maybe this could be somehow also done on the animation build time but that I think would introduce a lot of complexity (and thus would be much more prone to bugs I’d imagine)

1reaction
dario-piotrowiczcommented, Jul 22, 2022

@dionatan-g, I’m going to reply in the issue you’ve created 👍

(adding it here if anyone is following this thread: https://github.com/angular/angular/issues/46928)

Read more comments on GitHub >

github_iconTop Results From Across the Web

css - Angular 14 The animation trigger "rootItem" has built with ...
Angular 14 The animation trigger "rootItem" has built with the following warnings: - The following provided properties are not animatable: ...
Read more >
Deprecated APIs and features - Angular
Angular strives to balance innovation and stability. Sometimes, APIs and features become obsolete and need to be removed or replaced so that Angular...
Read more >
Change Log - /buttons - Kendo UI for Angular - Telerik
Learn what changes we have made in our Angular /buttons package.
Read more >
AngularJS: Developer Guide: Migrating from Previous Versions
Now, only changes to direct properties of the watched object will trigger changes. Core: Services. $compile. Due to 38f8c9, directive bindings are no...
Read more >
What's new in Angular 14.1? - Ninja Squad
Angular 14.1 is out! ... The existing CanActivate guard decides whether or not a ... The code property can have the following values: ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found