diff --git a/.changeset/wicked-eyes-prove.md b/.changeset/wicked-eyes-prove.md new file mode 100644 index 000000000000..4e907e00f366 --- /dev/null +++ b/.changeset/wicked-eyes-prove.md @@ -0,0 +1,5 @@ +--- +"astro": patch +--- + +Adds a warning in DEV mode when using view transitions on a device with prefer-reduced-motion enabled. diff --git a/packages/astro/components/ViewTransitions.astro b/packages/astro/components/ViewTransitions.astro index bf372f15cd39..97bf62096ac2 100644 --- a/packages/astro/components/ViewTransitions.astro +++ b/packages/astro/components/ViewTransitions.astro @@ -51,6 +51,9 @@ const { fallback = 'animate' } = Astro.props; } if (supportsViewTransitions || getFallback() !== 'none') { + if (import.meta.env.DEV && window.matchMedia('(prefers-reduced-motion)').matches) { + console.warn(`[transitions]: all view transition animations, including fallback animation, are disabled as this device has the prefer-reduced-motion setting enabled.`); + } document.addEventListener('click', (ev) => { let link = ev.target; if (ev.composed) {