Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an always option to view-transitions plugin that ignores reduced …
…motion preference. Otherwise skip transitions if true
- Loading branch information
1 parent
ff7fc9f
commit e64d5de
Showing
4 changed files
with
15 additions
and
2 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
packages/nuxt/src/app/plugins/view-transitions-safe.client.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { defineNuxtPlugin } from '#app/nuxt' | ||
import plugin from '#app/plugins/view-transitions.client' | ||
|
||
export default defineNuxtPlugin((nuxtApp) => { | ||
if (!document.startViewTransition || window.matchMedia('(prefers-reduced-motion: reduce)').matches) { return } | ||
|
||
plugin(nuxtApp) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters