Reduced motion and accessible website animation
By Pulse Labs · Published · Updated · 2 min read
Reduced motion is a setting in the visitor's operating system that says they want less movement on screen. Browsers pass it to your page as the prefers-reduced-motion media feature, and honouring it takes a few lines of CSS. Some people feel dizzy or sick from scroll-linked and zooming movement, so a page that ignores the setting can make them leave or worse.
This guide shows the CSS rule, the JavaScript version that also reacts when the setting changes while the page is open, and how to test both. The demo below reads your own device setting, so you can try it.
How the setting works
MDN documents two values: reduce, meaning the visitor has asked for less motion, and no-preference. The feature is Baseline widely available and has worked across browsers since January 2020. MDN's advice is to remove, reduce or replace motion-based animation inside a reduce block, especially scaling and panning of large objects.
It is a request, not a rule about what you must remove. Gentle fades are generally fine, and the W3C's explanation of Animation from Interactions says movement the user triggers by scrolling is different from decorative animation added on top. What it asks is that non-essential motion be possible to turn off.
Try it: a page that reads the setting
<p>Your device asks for: <strong id="state">checking</strong></p>
<div class="track"><i class="dot"></i></div>
<p class="hint">Change the reduced motion setting in your system while this is open. It reacts without a reload.</p>.track { position: relative; height: 40px; border-radius: 10px; background: #1b1530; border: 1px solid #3a3160; overflow: hidden; }
.dot { position: absolute; top: 10px; left: 10px; width: 20px; height: 20px; border-radius: 50%; background: #c8f250; animation: slide 2s ease-in-out infinite alternate; }
@keyframes slide { to { transform: translateX(calc(100cqw - 20px)); } }
.track { container-type: inline-size; }
.hint { color: #a79fc9; font-size: 14px; }
@media (prefers-reduced-motion: reduce) { .dot { animation: none; } }const q = matchMedia("(prefers-reduced-motion: reduce)");
const label = document.getElementById("state");
const show = () => { label.textContent = q.matches ? "reduce (the dot is still)" : "no preference (the dot moves)"; };
show();
q.addEventListener("change", show);The CSS pattern
.hero-title { animation: rise .6s ease-out both; }
@media (prefers-reduced-motion: reduce) {
.hero-title { animation: none; }
}Or invert it, so motion is opt-in and a browser that does not understand the query gets none:
.hero-title { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
.hero-title { animation: rise .6s ease-out both; }
}The JavaScript pattern
Use matchMedia to check once, and add a change listener because people can flip the setting while a page is open. Do not start animations you will immediately have to cancel.
const q = matchMedia("(prefers-reduced-motion: reduce)");
function start() { /* add your motion here */ }
function stop() { /* remove it, restore the plain page */ }
q.matches ? stop() : start();
q.addEventListener("change", () => (q.matches ? stop() : start()));How to test it
- Turn the setting on in your operating system, reload, and check that nothing moves except what the person triggered and needs.
- In a browser test tool, emulate the preference. In Playwright that is
page.emulateMedia({ reducedMotion: "reduce" }); we used it to check the demos in this guide. Chrome's developer tools also have a rendering option for it. - Check the page is still complete: nothing hidden, nothing waiting for an animation that will not run.
What your platform does for you
| Product | Reduced motion behaviour | Source |
|---|---|---|
| Elementor | Motion effects turn off for visitors who have enabled the OS reduced-motion setting | Elementor help |
| Framer | Effects are not applied if the Accessibility option is on in site settings and the device has reduced motion enabled; only opacity is animated | Framer help |
| Squarespace 7.1 | Visitors can turn off some animated features through their device settings, so animations may not appear for them | Squarespace help |
| Your own code | Whatever you write. Use the patterns above | MDN |
| MotionLift | Visitors who ask for less motion get your page with no added movement at all | Home page FAQ and guarantees |
If you add motion by script, ask the vendor how it behaves under the setting and test it yourself with the steps above. MotionLift's behaviour is stated on its home page and covered by the same test, and it also steps aside on slow devices and rests while people read. Motion design for websites covers what to leave still in the first place.