Skip to content

Revert "feat(core): add support for nested animations"#67632

Merged
mattrbeck merged 1 commit intoangular:mainfrom
thePunderWoman:revert_66848
Mar 12, 2026
Merged

Revert "feat(core): add support for nested animations"#67632
mattrbeck merged 1 commit intoangular:mainfrom
thePunderWoman:revert_66848

Conversation

@thePunderWoman
Copy link
Copy Markdown
Contributor

@thePunderWoman thePunderWoman commented Mar 11, 2026

This reverts commit ea2016a.

@thePunderWoman thePunderWoman added action: review The PR is still awaiting reviews from at least one requested reviewer area: core Issues related to the framework runtime target: patch This PR is targeted for the next patch release labels Mar 11, 2026
@ngbot ngbot Bot added this to the Backlog milestone Mar 11, 2026
@thePunderWoman thePunderWoman requested a review from atscott March 11, 2026 22:29
Copy link
Copy Markdown
Contributor

@atscott atscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we update the commit message to include either "fixes #67552" or some other description of why this is happening. I think the title should also be "fix: ..." so it shows up in changelog

This reverts commit ea2016a.

This reverts the support for nested animations due to the global scope of how nested animations were gathered.
This caused issues where on route navigations, all child nodes with animations would be queued and run before the navigation would occur.
We'll be revisiting the nested animations with a more tightened scope of when those leave animations will occur.

fixes: angular#67552
@atscott atscott added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Mar 11, 2026
@thePunderWoman thePunderWoman added the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Mar 12, 2026
@thePunderWoman
Copy link
Copy Markdown
Contributor Author

Caretaker note: the failing tests are previously failing and unrelated. This is safe to merge.

@mattlewis92
Copy link
Copy Markdown
Contributor

@thePunderWoman any chance that b4ec3cc could be reverted as well? (as it seems it was only added for this feature)

One of my coworkers noticed that fix breaks leave animations when artificially slowing them down for testing with chrome devtools (presumably as the animation duration is now much longer than is calculated with getComputedStyle, so the fallback timeout fires before the animation completes):
CleanShot 2026-03-12 at 11 39 49@2x

@thePunderWoman
Copy link
Copy Markdown
Contributor Author

@mattlewis92 We can consider that. We are planning on re-landing nested animations with a more strict scope fairly quickly. So we'll have to see if this fix still applies (it might).

@mattrbeck mattrbeck merged commit 999c14e into angular:main Mar 12, 2026
21 of 23 checks passed
@mattrbeck
Copy link
Copy Markdown
Member

This PR was merged into the repository. The changes were merged into the following branches:

@thePunderWoman
Copy link
Copy Markdown
Contributor Author

@mattlewis92 Looks like that fix will still be necessary. We could consider removing that fallback timer in devmode, but it would mean that the behavior would be different in dev vs prod, which isn't ideal. We could also consider maybe an injection token for debug purposes only and that would only work in devmode. What do you think?

@mattlewis92
Copy link
Copy Markdown
Contributor

@mattlewis92 Looks like that fix will still be necessary. We could consider removing that fallback timer in devmode, but it would mean that the behavior would be different in dev vs prod, which isn't ideal. We could also consider maybe an injection token for debug purposes only and that would only work in devmode. What do you think?

I think an injection token would be great - we have our own set of internal dev tools so we could easily toggle that on and off as needed when people need to debug animations in chrome dev tools

@thePunderWoman
Copy link
Copy Markdown
Contributor Author

@mattlewis92 Actually, I wonder if we can solve this by accounting for playback rate in the code that determines the longest animation length...

@thePunderWoman
Copy link
Copy Markdown
Contributor Author

thePunderWoman commented Mar 12, 2026

@mattlewis92 I think #67656 should do it.

Though it won't account for the case when we have to fallback to getComputedStyle...

@mattlewis92
Copy link
Copy Markdown
Contributor

@mattlewis92 I think #67656 should do it.

Though it won't account for the case when we have to fallback to getComputedStyle...

Unfortunately that doesn't seem to work, playbackRate is always set to 1 when slowing down animations:

CleanShot 2026-03-13 at 09 26 37@2x

Here was the AI answer I got when I asked about it:

  Chrome DevTools does this via the Chrome DevTools Protocol (CDP) at the
  browser engine level, bypassing the JavaScript-visible Web Animations API entirely. It uses
  the Animation.setPlaybackRate CDP command internally, so animation.playbackRate stays 1 from
  JS's perspective.

  Bottom line: there's no reliable way to detect DevTools animation slowdown from JavaScript.
  It's intentionally opaque to the page's script context.

  If you're trying to solve a specific testing problem (e.g. waiting for animations to finish,
  or skipping animations in tests), there are better approaches:

  - animation.finished — returns a Promise that resolves when the animation completes,
  regardless of playback speed
  - animation.onfinish — same idea as a callback
  - animation.ready then animation.finish()** — programmatically jump to the end
  - For tests specifically, mock/stub Animation or use Animation.prototype.finish() to skip
  animations altogether

@thePunderWoman
Copy link
Copy Markdown
Contributor Author

@mattlewis92 wonderful. OK, I'll look at the devmode only injection token, and we'll name it very clearly for what it's for.

@angular-automatic-lock-bot
Copy link
Copy Markdown

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.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Apr 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants