Basic

Motion, sound, and time limits

Anything that moves, flashes, or makes sound needs an off switch and a safe default. The platform already tells you what the user wants: honor it, and do not invent your own guess.

What you will see

No animation. If something still moves, it is a JS-driven animation, not a CSS one.

About 1 min of reading

Try It

Make motion opt-in instead of opt-out

1

Find the animations

grep -cE '@keyframes|animation:' public/css/main.css

Before you run it, say out loud what it will print. Then open the answer.

What it prints
The count of animated rules on the site.
2

Wrap them

printf '@media (prefers-reduced-motion: reduce) {\n *, *::before, *::after { animation: none; transition: none; }\n}\n' | tee -a public/css/main.css

Before you run it, say out loud what it will print. Then open the answer.

What it prints
A rule that removes motion when the OS says reduce.
3

Bump the token

grep -n 'main.css?v=' views/partials/head.ejs

Before you run it, say out loud what it will print. Then open the answer.

What it prints
Change the token so the new rule is served.
4

Test with the OS setting

open the page with reduced motion enabled in the OS and confirm nothing moves

Before you run it, say out loud what it will print. Then open the answer.

What it prints
No animation. If something still moves, it is a JS-driven animation, not a CSS one.
A JS animation ignores the CSS query. Gate it in code by reading matchMedia('(prefers-reduced-motion: reduce)') before starting it.

Data Flow

OS preference to a rule
1 Operating system records a preference
↓
2 Browser exposes prefers-reduced-motion
↓
3 CSS wraps animation rules in that query
↓
4 Page ships the calm version by default
Why this works
The safe default

Ship no motion, then add motion only inside the media query. That way a browser that does not support the query gets the calm version, which is the safe direction.

What reduced motion does not cover

It does not cover parallax, auto-advancing carousels, or a timer that forces an action. Those need their own pause controls, and the media query is not enough.

Examples

Honor the OS setting

@media (prefers-reduced-motion: reduce) wraps the animation rules. The user's operating system made that choice; your job is to read it, not to ask again.

No flashing without a stop

Anything that flashes more than three times per second must be stoppable and must not flash for more than a second. A pause control is required, not optional.

Auto-playing audio needs a mute

Audio that starts without a user action needs a visible way to stop it on the same page. The cheapest fix is to not autoplay at all.

Words this lesson uses

Each one is defined here on this site. Open the entry for the full definition and the other words it points at.

← Contrast and color that is not the message
Previous Lesson
Contrast and color that is not the message
Next Lesson
Tables that announce their structure
Tables that announce their structure →