Skip to content

Commit

Permalink
Prevent animations with prefers-reduced-motion (#7757)
Browse files Browse the repository at this point in the history
* Prevent animations with prefers-reduced-motion

* Also disable animations in the fallback

* Change select to target elements
  • Loading branch information
matthewp authored Jul 21, 2023
1 parent 471324b commit c2d6cfd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/poor-cameras-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Prevent animations when prefers-reduced-motion
12 changes: 12 additions & 0 deletions packages/astro/components/viewtransitions.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,15 @@
transform: translateX(-100%);
}
}

@media (prefers-reduced-motion) {
::view-transition-group(*),
::view-transition-old(*),
::view-transition-new(*) {
animation: none !important;
}

[data-astro-transition-scope] {
animation: none !important;
}
}

0 comments on commit c2d6cfd

Please sign in to comment.