|
97 | 97 | } |
98 | 98 |
|
99 | 99 | /** |
100 | | - * UFX-020, UFX-021: Respect user preference for reduced motion. |
| 100 | + * UFX-020: Respect user preference for reduced motion. |
101 | 101 | * |
102 | | - * Affected browsers: All browsers that support prefers-reduced-motion |
103 | | - * Description: Users with vestibular motion disorders or motion sensitivity |
104 | | - * can indicate they prefer reduced motion. This ensures smooth scrolling |
105 | | - * is disabled for these users. |
| 102 | + * Users with vestibular motion disorders or motion sensitivity can indicate |
| 103 | + * they prefer reduced motion. This aggressively disables animations and |
| 104 | + * transitions for these users. |
| 105 | + * |
| 106 | + * Why 0.01ms instead of 0ms? |
| 107 | + * Ensures `animationend` and `transitionend` events still fire, so JS |
| 108 | + * that depends on these events doesn't break. |
106 | 109 | * |
107 | 110 | * References: |
108 | 111 | * - https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion |
109 | 112 | * - https://www.smashingmagazine.com/2021/10/respecting-users-motion-preferences/ |
110 | 113 | * - https://web.dev/prefers-reduced-motion/ |
111 | 114 | * |
112 | 115 | * Aligned with: |
113 | | - * - Josh Comeau – @media (prefers-reduced-motion: reduce) handling |
114 | | - * - Andy Bell (Piccalilli) – more aggressive (animation/transition-duration: 0.01ms) |
115 | | - * - Jake Lazaroff – scroll-behavior: auto |
116 | | - * |
117 | | - * UFX-022: Additional reductions (animation-duration, transition-duration) |
118 | | - * are intentionally omitted in v1 to avoid breaking intentional animations. |
119 | | - * Implementers should handle these in their own stylesheets as needed. |
| 116 | + * - Andy Bell (Piccalilli) – animation/transition-duration: 0.01ms |
| 117 | + * - Josh Comeau – scroll-behavior handling |
120 | 118 | */ |
121 | 119 | @media (prefers-reduced-motion: reduce) { |
122 | | - * { |
| 120 | + *, |
| 121 | + *::before, |
| 122 | + *::after { |
| 123 | + animation-duration: 0.01ms !important; |
| 124 | + animation-iteration-count: 1 !important; |
| 125 | + transition-duration: 0.01ms !important; |
123 | 126 | scroll-behavior: auto !important; |
124 | 127 | } |
125 | 128 | } |
|
0 commit comments