nextjs - 💡(How to fix) Fix ViewTransition exit animations do not fire when using `router.back()` [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#86879Fetched 2026-04-08 02:08:36
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Author
Timeline (top)
closed ×2commented ×1issue_type_added ×1labeled ×1

Code Example

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:40 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6041
  Available memory (MB): 49152
  Available CPU cores: 14
Binaries:
  Node: 20.18.3
  npm: 10.8.2
  Yarn: N/A
  pnpm: 10.18.2
Relevant Packages:
  next: 16.0.7 // Latest available version is detected (16.0.7).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.0.2
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/agadzik/v0-next-js-app-with-modal/pull/1

To Reproduce

  1. Start the application in development mode (pnpm dev)
  2. Click on the "Open About (Modal)" button, notice the enter view transition animation trigger
  3. Press ESC or click outside of the modal to close it.
  4. Notice that the exit view transition animation does not trigger

Current vs. Expected behavior

When using the new <ViewTransition> element from react and the latest version of next, exit animations do not trigger when using router.back()

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:40 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6041
  Available memory (MB): 49152
  Available CPU cores: 14
Binaries:
  Node: 20.18.3
  npm: 10.8.2
  Yarn: N/A
  pnpm: 10.18.2
Relevant Packages:
  next: 16.0.7 // Latest available version is detected (16.0.7).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.0.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Not sure

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local), Vercel (Deployed)

Additional context

No response

extent analysis

TL;DR

The issue with the exit view transition animation not triggering when using router.back() in a Next.js application with the new <ViewTransition> element from React may be resolved by modifying the animation trigger logic to accommodate the router.back() behavior.

Guidance

  • Review the implementation of the exit view transition animation to ensure it is correctly triggered when the modal is closed using router.back().
  • Verify that the router.back() method is properly handling the animation state, potentially by adding a custom animation handler.
  • Check the React and Next.js documentation for any known issues or limitations related to using router.back() with the <ViewTransition> element.
  • Consider testing the animation with a different closing method, such as a button click, to isolate the issue.

Example

No code snippet is provided as the issue lacks specific implementation details.

Notes

The provided environment information and package versions may be relevant to the issue, but without further details, it is difficult to determine the exact cause.

Recommendation

Apply workaround: Modify the animation trigger logic to accommodate the router.back() behavior, as the issue seems to be related to the interaction between the router.back() method and the <ViewTransition> element.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - 💡(How to fix) Fix ViewTransition exit animations do not fire when using `router.back()` [1 comments, 2 participants]