Skip to content

feat(view-transitions): implement View Transition API for smoother pa…#12276

Open
soheilnikroo wants to merge 1 commit into
facebook:mainfrom
soheilnikroo:feat/view-transitions
Open

feat(view-transitions): implement View Transition API for smoother pa…#12276
soheilnikroo wants to merge 1 commit into
facebook:mainfrom
soheilnikroo:feat/view-transitions

Conversation

@soheilnikroo

@soheilnikroo soheilnikroo commented Jul 12, 2026

Copy link
Copy Markdown

…ge navigation

  • Added support for the View Transition API to enable animated transitions between routes during client-side navigation.
  • Updated PendingNavigation to utilize the new API, allowing for smoother visual transitions.
  • Introduced viewTransitionUtils for managing view transitions and added corresponding CSS for animations.
  • Added documentation and a guide on how to enable and customize view transitions in the Docusaurus configuration.
  • Updated tests to cover new functionality and ensure proper behavior of view transitions.

This feature is experimental and can be enabled via the experimental_viewTransitions flag in the configuration.

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

View Transitions improve SPA navigation UX. Client modules can't implement this because onRouteUpdate fires before the DOM swap. PendingNavigation already keeps the previous route mounted during preload — this PR wraps the final commit in startViewTransition() + flushSync().

#12223

Test Plan

  • Unit tests for viewTransitionUtils (8 tests)
  • Config validation + snapshot updates
  • @docusaurus/core builds successfully
  • Manual: navigate between pages in Chrome/Safari 18+
  • Manual: verify no animation with prefers-reduced-motion: reduce
  • Manual: verify hash-only navigation stays instant
  • Manual: verify Firefox fallback (instant, no errors)

Test links

Deploy preview: https://deploy-preview-_____--docusaurus-2.netlify.app/

Related issues/PRs

…ge navigation

- Added support for the View Transition API to enable animated transitions between routes during client-side navigation.
- Updated `PendingNavigation` to utilize the new API, allowing for smoother visual transitions.
- Introduced `viewTransitionUtils` for managing view transitions and added corresponding CSS for animations.
- Added documentation and a guide on how to enable and customize view transitions in the Docusaurus configuration.
- Updated tests to cover new functionality and ensure proper behavior of view transitions.

This feature is experimental and can be enabled via the `experimental_viewTransitions` flag in the configuration.
@meta-cla

meta-cla Bot commented Jul 12, 2026

Copy link
Copy Markdown

Hi @soheilnikroo!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@netlify

netlify Bot commented Jul 12, 2026

Copy link
Copy Markdown

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit 264aada
🔍 Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/6a53729c565ca00008b31455
😎 Deploy Preview https://deploy-preview-12276--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@meta-cla

meta-cla Bot commented Jul 12, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the CLA Signed Signed Facebook CLA label Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant