Skip to content

False positive warnings about not animatable properties #46928

Closed as not planned

Description

@dionatan-g

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

animations

Is this a regression?

No

Description

There was already a fix for this warnings on #46666 but it didn't fix all the false positives.

For example with this code I get warnings.

export const collapse: AnimationTriggerMetadata = trigger('collapseAnimation', [
  state('expanded', style({ height: '*', visibility: 'visible' })),
  state('hidden', style({ height: 0, overflow: 'hidden', borderTopWidth: '0', visibility: 'hidden' })),
  transition('expanded => hidden', animate(`150ms ${AnimationCurves.EASE_IN_OUT}`)),
  transition('hidden => expanded', animate(`150ms ${AnimationCurves.EASE_IN_OUT}`)),
]);
<div class="collapse-content"
     [class.collapse-content-active]="active"
     [@collapseAnimation]="active ? 'expanded' : 'hidden'">
  <div class="collapse-content-box">
    <ng-content></ng-content>
  </div>
</div>

For me to remove the overflow hidden, I would have to set the style manually with the same delay as the animation.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

Warning: The animation trigger "collapseAnimation" is attempting to animate the following not animatable properties: overflow
(to check the list of all animatable properties visit 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.4
Node: 16.15.1
Package Manager: npm 8.13.2
OS: win32 x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1400.4
@angular-devkit/build-angular   14.0.4
@angular-devkit/core            14.0.4
@angular-devkit/schematics      14.0.4
@angular/animations             14.0.6
@schematics/angular             14.0.4
ng-packagr                      14.0.3
rxjs                            7.5.5
typescript                      4.7.4

Anything else?

No response

Activity

  1. added
    area: animations
    on Jul 22, 2022
  2. added this to the needsTriage milestone on Jul 22, 2022
  3. pkozlowski-opensource commented on Jul 22, 2022

    @pkozlowski-opensource
    Member
  4. dario-piotrowicz commented on Jul 22, 2022

    @dario-piotrowicz
    Contributor

    Thanks for tagging me @pkozlowski-opensource 🙂

    @dionatan-g sorry, I do not believe this is a false positive, let me explain why, the fact is that your code is actually trying to animate the overflow property, as you can see from the keyframes that gets generated for the player:

    Screenshot at 2022-07-22 22-47-55

    You can see that it is trying to transition from an overflow of visible to an overflow of hidden, this is because the lack of an overflow in the first state just means that for the animation the current value of that property is taken from the dom element itself, as you can see here:
    Screenshot at 2022-07-22 22-52-38


    I would also like to add that I believe this is the desired functionality, for example from my first screenshot you can see that I added a background color to the animation, this is my animation code:

    const collapse: AnimationTriggerMetadata = trigger('collapseAnimation', [
      state('expanded', style({ height: '*', visibility: 'visible' })),
      state('hidden', style({ height: 0, overflow: 'hidden', borderTopWidth: '0', visibility: 'hidden', backgroundColor: 'blue' })),
      transition('expanded => hidden', animate(`5s`)),
      transition('hidden => expanded', animate(`5s`)),
    ]);

    and I added a background-color: red; (note, red not rgb(255, 0, 0) as present in the screenshot, since that is the computed value) to the element's css

    and this allows us to be able to transition from/to the red background without the need to specify that (or being forced to manually add *) in the animations data:
    Peek 2022-07-22 22-56


    Anyways what is happening with the background color is precisely the same as it is happening with your overflow, so I do believe that the current implementation is correct in providing the warning since for all intents and purposes you are actually trying to transition from overflow: visible to overflow: hidden.

    I hope this helps, please let me know what you think 🙂

  5. added
    P3
    on Nov 16, 2022
  6. modified the milestones: needsTriage, Backlog on Nov 16, 2022
  7. strigefleur commented on Jan 30, 2023

    @strigefleur

    @dario-piotrowicz the point is taken; but could you please share the right way to deal with such a non-animatable properties that have to be set in the end of transition?

    whatever the rest of style props are the opposite animation states should respectively set overflow: hidden and overflow: visible - how'd you implement it within animation cycle itself having no warning?

  8. dario-piotrowicz commented on Jan 30, 2023

    @dario-piotrowicz
    Contributor

    how'd you implement it within animation cycle itself having no warning?

    I'd just use states one in the initial state with the hidden overflow and one in the end start with a overflow visible.

    That's the right way in my opinion to use Angular animations to set (not animate) styles.

    Do you see some issue with that?

  9. strigefleur commented on Jan 30, 2023

    @strigefleur

    I'm afraid I still don't get the idea to avoid the warning; using the simplified example:

    const collapse = trigger('collapseAnimation', [
      state('expanded', style({ height: AUTO_STYLE })),
      state('hidden', style({ height: 0, overflow: 'hidden' })),
      transition('expanded => hidden', animate(`5s`)),
      transition('hidden => expanded', animate(`5s`)),
    ]);

    we still have overflow within the style-set resulting thus in a same warning, no?

  10. dario-piotrowicz commented on Jan 30, 2023

    @dario-piotrowicz
    Contributor

    Ah no sorry, yeah you're right, I wasn't thinking of that, apologies 😓

    In your case yeah I would suspect that we would definitely need a way to suppress the warning...

    The alternative I can think of is using animation callbacks so that when the transition ends you can set the style of your element in whichever way you prefer.

    I've a bit torn on this one, on one hand I understand that using callbacks is going to create more unnecessary code, on the other I think that it's sort of the cleanest thing since in the animation code you are practically indeed trying to animate a property that is not animatable...

    yeah I think that at the very least we should provide a way so that developers can suppress the warning so that in any case they'd be able to decide what they prefer

  11. strigefleur commented on Jan 30, 2023

    @strigefleur

    Thank you for the idea.
    Though I guess animation callback is way too much: imagine you have one prepared animation and tens of components using it - you'd have to insert such a callback so many times just to satisfy the questionable approach.

    I was hoping for something like being able to add/remove a class on state transition but it appears there's no way as well.

  12. dario-piotrowicz commented on Jan 30, 2023

    @dario-piotrowicz
    Contributor

    yeah you're right...

    yes, as far as I can tell there isn't a way of doing that in the animation's metadata 😓

    I'm sorry if this is inconveniencing you (I'm the one who introduced the warning) 🙇 , if it helps I was already planning to soon look into some way to make the warning configurable so that users can opt out of it.

    (As per this discussion)

  13. dionatan-g commented on Jan 31, 2023

    @dionatan-g
    Author

    Oh, look who's back 😆
    I apologize for the ghost @dario-piotrowicz , I remember I read your reply at the time and completely forgot to answer it.
    What I did was doing nothing, since I didn't have any easy way to solve the warnings, just like @strigefleur mentioned.
    In the meantime, since the warning was introduced and now, I had a few devs (4 to be precise) questioning me about those warnings and how they could fix it.
    So everytime I had to explain that there is nothing wrong, is just a warning that was introduced because of the non-animatable properties etc.
    Which is pretty anoying for me 😅
    Even tho I didn't see many issues or upvotes on this one, I think there's a lot of people that either think they are doing something completely wrong and just stoped trying to use animation or they just opened issues at the component library repos, not in Angular's repo.

    Imo, this warning should be the other way around, until we don't have a clear way to refactor, it should be disabled. When we actually have an alternative that is pratical, then the warning can be enabled again.

  14. dario-piotrowicz commented on Feb 4, 2023

    @dario-piotrowicz
    Contributor

    @dionatan-g no problem 🙂

    To give some context I've introduced the warning as a way to prevent such issues: #27577

    So it is something that should help developers not hinder them 😓

    Anyways I am sorry to hear that it's causing you grief I will look into a way to disabling the warning 🙇
    But disabling it completely would remove any benefit of it (thus not helping in cases like issue 27577), I think it could be enough to keep it but provide a very easy way to disable it (and mention that way in the warning, something like "if you don't want to see this warning again do ...") , what do you think?

  15. 21 remaining items

  16. superole commented on Mar 7, 2024

    @superole
    Contributor

    The web animations "standards" are clearly "in motion" so to speak. I wonder who maintains the list of "not animatable" properties for this warning? All your references in #27577 (comment), @dario-piotrowicz, seem to contradict your statements now.

  17. igorrust commented on Mar 13, 2024

    @igorrust

    @dario-piotrowicz Guess which problem I ran into today 😅 , haha glad it's being worked on, I found it strange since the animation works, this time it's 'position'.

    Yep, I'm also seeing this warning with an animation on background-position-y (while it's clearly moving in Chrome/FF 😅)

  18. koscik commented on Sep 12, 2024

    @koscik

    When should we expect this issue to go away?

  19. ryanrapini-bep commented on Oct 18, 2024

    @ryanrapini-bep

    Any updates on this issue? Is there a workaround available?

  20. 0xka13b commented on Dec 25, 2024

    @0xka13b

    up

  21. olemartinsorli commented on Aug 20, 2025

    @olemartinsorli
    Contributor

    Why are you not planning to solve this?

  22. JeanMeche commented on Aug 20, 2025

    @JeanMeche
    Member

    As of 20.2 we're deprecating the animation package.

    We invite you to have a look at the new animate options https://angular.dev/guide/animations/enter-and-leave

  23. thePunderWoman commented on Aug 21, 2025

    @thePunderWoman
    Contributor

    This issue was closed as obsolete due to the introduction of the new animate.enter and animate.leave APIs. The @angular/animations package is now deprecated and will be removed in Angular v23. We hope you give the new APIs a try.

  24. angular-automatic-lock-bot commented on Sep 21, 2025

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  25. locked and limited conversation to collaborators on Sep 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3area: animations

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions