Accessible Motion: prefers-reduced-motion and Meaningful Animation
Animation that helps instead of harms: vestibular and seizure risks, WCAG rules on flashing and moving content, prefers-reduced-motion in CSS and JavaScript, reducing motion instead of removing feedback, the global override, and meaningful motion.
kvi5hnuCode Sprout team member7 min readOn this page
Motion helps people understand an interface: a panel sliding in shows where it came from, and a button that reacts confirms the press. But for many people, motion is a problem. Vestibular disorders, which affect the inner ear's sense of balance, mean that large movements, zooms and parallax can cause dizziness, nausea and migraines. Rapid flashing can trigger seizures in people with photosensitive epilepsy. And constant movement distracts everyone, especially people with attention or cognitive disabilities.
The WCAG rules
| Criterion | Level | Requirement |
|---|---|---|
| 2.3.1 Three Flashes or Below Threshold | A | nothing flashes more than three times in any one second, unless the flashes are small and dim enough |
| 2.2.2 Pause, Stop, Hide | A | moving, blinking or scrolling content that starts automatically, lasts more than 5 seconds and is shown alongside other content can be paused, stopped or hidden |
| 2.3.3 Animation from Interactions | AAA | motion triggered by interaction can be turned off, unless it's essential |
2.3.1 and 2.2.2 apply to every site that aims for level AA. 2.3.3 is AAA, but respecting the reduced motion setting is the standard way to meet it, and it's easy to do.
prefers-reduced-motion
Operating systems have a setting to reduce motion: Reduce motion on macOS and iOS, Animation effects off on Windows, and Remove animations on Android. Browsers expose it as a media feature (article 76):
| Value | Meaning |
|---|---|
no-preference | no setting, or motion is fine |
reduce | the user has asked for less motion |
@media (prefers-reduced-motion), with no value, is true for reduce. Tested in Chrome, with reduced motion emulated, both (prefers-reduced-motion: reduce) and (prefers-reduced-motion) matched. Developer tools can emulate the setting: the Rendering drawer in Chrome (article 4).
Reduce, don't just remove

"Reduced" means less movement, not zero feedback. Users who turn it on still need to see that a menu opened or a form was saved. The problem is mostly movement across the screen, scaling, rotation and parallax, so replace those with fades, which don't move anything:
.panel { transition: opacity 0.3s, translate 0.3s; }
.panel:not(.open) { opacity: 0; translate: 100% 0; }
@media (prefers-reduced-motion: reduce) {
.panel { transition: opacity 0.2s; } /* fade only */
.panel:not(.open) { translate: 0 0; }
}
Two ways to organize the CSS:
- Reduce on request: write the full motion, then tone it down inside
@media (prefers-reduced-motion: reduce). This is the usual approach. - Motion on request: write a calm default and add motion only inside
@media (prefers-reduced-motion: no-preference). Browsers that don't support the media feature get the calm version, and you can't forget to cover a new animation:
.card { transition: opacity 0.2s; }
@media (prefers-reduced-motion: no-preference) {
.card { transition: opacity 0.2s, translate 0.3s, scale 0.3s; }
.card:hover { translate: 0 -4px; scale: 1.02; }
}
With custom properties, one place can control all motion:
:root { --motion: 1; }
@media (prefers-reduced-motion: reduce) { :root { --motion: 0; } }
.toast { translate: 0 calc(var(--motion) * 1rem); }

The bottom strip was rendered with reduced motion emulated: the components still announce themselves, through opacity, but nothing travels or zooms.
The global override
A common safety net turns every animation and transition into an instant change:
@media (prefers-reduced-motion: reduce) {
*, ::before, ::after {
scroll-behavior: auto !important; /* jump instead of smooth scrolling */
transition-duration: 1ms !important;
animation-iteration-count: 1 !important; /* no infinite loops */
animation-duration: 1ms !important;
}
}
It uses a tiny duration rather than none so that animationend and transitionend still fire, so code waiting for them keeps working. Tested in Chrome, with reduced motion emulated:
- An infinite 2s animation computed to a single 1ms iteration, and
animationendfired. - A transition still fired
transitionend. scroll-behavior: smoothon the root computed toauto.
It also has drawbacks:
- It removes all feedback, including harmless fades.
- Animations end on their final frame. Loading spinners stop, so they need another loading indicator, such as text.
- It overrides any carefully designed reduced-motion versions, because of
!important.
Use it as a backstop on sites with many third-party animations, and design reduced versions for your important ones.
In JavaScript
Animations started from JavaScript, smooth scrolling with scrollIntoView({ behavior: 'smooth' }), and motion libraries must check the setting too:
const reduce = matchMedia('(prefers-reduced-motion: reduce)');
function scrollToSection(el) {
el.scrollIntoView({ behavior: reduce.matches ? 'auto' : 'smooth' });
}
reduce.addEventListener('change', () => { /* stop or start ambient animations */ });
Auto-playing content
Carousels that advance by themselves, animated backgrounds, marquees, autoplaying video and animated GIFs all fall under WCAG 2.2.2 when they run for more than 5 seconds.
- Provide a visible pause button, and pause on hover and focus.
- Don't autoplay at all with reduced motion. For video, honor the setting with JavaScript, and for GIFs, use a
<picture>with a still image in a(prefers-reduced-motion: reduce)<source>. - Stop decorative loops after a few iterations:
animation-iteration-count: 3.
<picture>
<source srcset="hero-still.png" media="(prefers-reduced-motion: reduce)">
<img src="hero-animated.gif" alt="A product tour showing the dashboard">
</picture>
Meaningful animation
Every animation should have a job:
- Feedback: confirming an action, like a button press or a saved item.
- Orientation: showing where something came from or went, like a panel sliding from its button.
- Continuity: connecting two states, so users don't lose track during a change.
- Attention: pointing out something important, used rarely, since attention effects that repeat become noise.
And some principles:
- Keep interface motion short, 150 to 400ms (article 107). Slow animations make people wait.
- Prefer small distances; large movements are what cause vestibular problems.
- Never make information or a task depend on seeing an animation.
- Don't animate on scroll by default. Scroll-linked effects (article 113) need reduced-motion handling.
- Let animations be interrupted. Transitions handle this better than keyframe animations (article 110).
body { font: 0.85rem system-ui, sans-serif; margin: 1rem; --motion: 1; }
body.reduce { --motion: 0; } /* stands in for the media query below */
@media (prefers-reduced-motion: reduce) { body { --motion: 0; } }
button { font: inherit; padding: 0.3rem 0.7rem; }
.sim { display: block; margin-block-end: 0.5rem; }
.stage { overflow: clip; } /* hides the panel while it's off to the side */
.panel {
margin-block: 0.5rem; padding: 0.6rem; border-radius: 8px; background: #f4efe6;
transition: opacity 0.25s, translate 0.3s ease-out;
}
.panel:not(.open) { opacity: 0; translate: calc(var(--motion) * 110%) 0; pointer-events: none; }
.panel p { margin: 0 0 0.4rem; }
.status { display: flex; align-items: center; gap: 0.4rem; }
.spinner {
inline-size: 1rem; block-size: 1rem; border-radius: 50%; border: 3px solid #eee6d8; border-top-color: #8a3b12;
animation: spin 0.8s linear infinite;
}
.reduce .spinner { animation: pulse 1.6s ease-in-out infinite alternate; } /* a gentle pulse instead of spinning */
@keyframes spin { to { rotate: 1turn; } }
@keyframes pulse { from { opacity: 1; } to { opacity: 0.4; } }
.marquee { overflow: hidden; white-space: nowrap; border-block: 1px solid #d8cfc0; padding-block: 0.3rem; }
.marquee span { display: inline-block; animation: scroll 10s linear infinite; }
@keyframes scroll { to { translate: -50% 0; } }
.reduce .marquee span, .paused .marquee span { animation-play-state: paused; }
Open the panel with and without the simulation: it slides in normally, and only fades with reduced motion, because --motion multiplies the distance by 0. The spinner becomes a gentle pulse, and the scrolling text stops. The pause button meets WCAG 2.2.2 for everyone. The real prefers-reduced-motion setting does the same through the media query.
What's current
prefers-reduced-motion: all browsers.prefers-reduced-transparencyexists in Chromium (article 76); there's no media feature for flashing or for autoplay preferences.
Common questions
Should I remove all animation for reduced motion? No. Remove or replace large movement, zooms, parallax and loops; keep fades and color changes that give feedback.
Is the 1ms override enough?
It's a safety net. It removes useful feedback and stops spinners, so design reduced versions for important animations.
How do I test it? Turn on your system's reduce motion setting, or emulate it in the browser's Rendering tools.
Does prefers-reduced-motion cover smooth scrolling?
Only if you make it: set scroll-behavior: auto under reduce, and check it in JavaScript before smooth scrolling.
Summary
- Motion can cause dizziness, nausea and seizures; WCAG limits flashing and requires a way to pause automatic movement.
prefers-reduced-motion: reducemeans less movement, not no feedback: replace slides and zooms with fades.- Either reduce motion on request, or add motion only under
no-preference. - The global
1msoverride keeps events firing but removes all feedback; use it as a backstop. - Check the setting in JavaScript, pause autoplaying content, and give every animation a purpose.
Practice questions
Rewrite this so users who prefer reduced motion see a fade instead of a slide.
.toast { transition: translate 0.3s, opacity 0.3s; }
.toast:not(.show) { translate: 0 2rem; opacity: 0; }
Answer
@media (prefers-reduced-motion: reduce) {
.toast:not(.show) { translate: 0 0; }
}
The toast no longer moves, but still fades in and out.
Why does the common override use animation-duration: 1ms instead of animation: none?
Answer
With a tiny duration, the animations still run, instantly, so animationend and transitionend still fire, and code that waits for them keeps working. animation: none would also drop the end state of forwards fills.
A homepage has a carousel that advances every 4 seconds. What does WCAG require?
Answer
It starts automatically and lasts more than 5 seconds, so under 2.2.2 users must be able to pause, stop or hide it, for example with a visible pause button. It should also not advance automatically when reduced motion is requested.
Write CSS that adds a hover lift only for users who haven't asked for reduced motion.
Answer
@media (prefers-reduced-motion: no-preference) {
.card { transition: translate 0.2s; }
.card:hover { translate: 0 -4px; }
}
Previous: Animation Performance: The Rendering Pipeline, Compositing and will-change
Next: Scroll-Driven Animations: scroll(), view() and Animation Ranges

More in CSS Course
Quiz: CSS Delicate Details
Twenty-five questions on the edge cases that surprise experienced developers: invalid custom properties, shorthands that reset values, layer order with !important, containing blocks, margin collapsing, specificity of :is() and :where(), intrinsic minimum sizes, and more, each checked in Chrome.
Quiz: CSS Interview Questions
Thirty front-end interview questions: cascade, specificity and layers, box model and margin collapsing, stacking contexts, positioning, flexbox and grid, responsive design, custom properties, performance, accessibility, modern selectors and architecture.
Quiz: CSS Course Final Exam
Thirty questions across the whole CSS course: syntax and error handling, selectors, the cascade and layers, values and units, color, the box model, backgrounds, positioning, flexbox, grid, responsive design, typography, generated content, effects, transforms, motion and architecture.
Quiz: CSS Architecture, Tooling and Debugging (CSS Part 17)
Twenty questions on modular CSS and BEM, layering a stylesheet, design tokens and theming, pattern libraries and safe refactoring, preprocessors and build tools, the at-rules reference, and debugging common CSS problems.
Discussion
Sign in to ask a question or share what you learned.