Skip to content

Cannot use multiple classes separated by space in animate.leave #62964

Closed

Description

@imaksp

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

compiler

Is this a regression?

No

Description

Add div like this in any component and remove it from DOM to trigger leave animation :

<div
  class="border-ring/10 animate-fade animate-duration-500 tracking-wide backdrop-blur-sm"
  cdkMenu
  animate.leave="animate-jump-out animate-duration-300"
>
  menu items
</div>

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

root_effect_scheduler.mjs:3597 ERROR InvalidCharacterError: Failed to execute 'add' on 'DOMTokenList': The token provided ('animate-jump-out animate-duration-300') contains HTML space characters, which are not valid in tokens.
    at NoneEncapsulationDomRenderer.addClass (dom_renderer.mjs:658:18)

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

Angular CLI: 20.2.0-next.2
Node: 22.14.0
Package Manager: yarn 4.9.2
OS: darwin arm64

Angular: 20.2.0-next.3
... common, compiler, compiler-cli, core, forms
... platform-browser, platform-server, router

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.2002.0-next.2
@angular-devkit/core         20.2.0-next.2
@angular-devkit/schematics   20.2.0-next.2
@angular/build               20.2.0-next.2
@angular/cdk                 20.1.4
@angular/cli                 20.2.0-next.2
@angular/ssr                 20.2.0-next.2
@schematics/angular          20.2.0-next.2
rxjs                         7.8.2
typescript                   5.9.2

Anything else?

it should work correctly with multiple classes in animate.out. (Currently it works only if we provide single class name)

Activity

  1. added
    area: animations
    on Aug 2, 2025
  2. added this to the needsTriage milestone on Aug 2, 2025
  3. tomer953 commented on Aug 3, 2025

    @tomer953
    Contributor

    For multiple class name, the api is consistent with class binding, meaning you should pass array of strings

  4. thePunderWoman commented on Aug 4, 2025

    @thePunderWoman
    Contributor

    @imaksp Both a string with a space and an array of strings should work. Can you create a stackblitz minimal repro for us? Specifically with the CDK? That'd be really helpful for debugging it.

  5. added
    needs reproduction
    on Aug 4, 2025
  6. modified the milestones: needsTriage, Backlog on Aug 4, 2025
  7. added
    core: animations
    on Aug 4, 2025
  8. thePunderWoman commented on Aug 4, 2025

    @thePunderWoman
    Contributor

    @imaksp Actually don't worry about the repro. I was able to reproduce it in a test. Thanks for reporting this!

  9. removed
    needs reproduction
    on Aug 4, 2025
  10. modified the milestones: Backlog, needsTriage on Aug 4, 2025
  11. added a commit that references this issue on Aug 4, 2025
    9da6885
  12. added
    area: core
    and removed
    area: animations
    on Aug 4, 2025
  13. added a commit that references this issue on Aug 4, 2025
    3107c45
  14. added a commit that references this issue on Aug 4, 2025
    6597ac0
  15. imaksp commented on Aug 4, 2025

    @imaksp
    ContributorAuthor

    Hi, thanks for the quick fix!

  16. angular-automatic-lock-bot commented on Sep 4, 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.

  17. locked and limited conversation to collaborators on Sep 4, 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

    area: corecore: animations

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions