lesson
35 min

Accessible, Safe Motion

Build a simple animation that respects reduced-motion settings and avoids flashing.

Objective

By the end of this lesson, you can build a simple web animation that turns off when a device asks for reduced motion, and explain the flashing rule.

Motion can hurt people

Motion is not neutral. For some people, it causes real harm.

  • Flashing can trigger seizures in people with photosensitive epilepsy.
  • Large, fast movement can cause dizziness and nausea for people with vestibular (inner ear) disorders.
  • Constant movement makes reading hard for people with attention or reading differences.

Two rules to follow

  1. No more than three flashes in any one second. This comes from WCAG, the Web Content Accessibility Guidelines. When in doubt, do not flash at all.
  2. Respect reduced motion. Phones and computers from Apple, Microsoft, and Google have a "reduce motion" setting. Websites can read it with a CSS rule called prefers-reduced-motion and calm their animations.

A national example

Build it: a logo that slides in, unless you ask it not to

This Code Lab has a simple animated logo. The last few lines of the CSS turn the animation off when a device asks for reduced motion. Keyboard users: press Esc, then Tab, to leave the editor.

Reduced-motion logo

Watch the logo slide in. Change the animation time from 1s to 3s. Then turn on 'reduce motion' in your device settings and reload. The logo should appear without moving.

Loading the code editor...

Press Esc, then Tab, to move focus out of the editor.

Here is the key rule on its own:

@media (prefers-reduced-motion: reduce) {
  .logo { animation: none; }
}

Make your motion accessible

Motion accessibility check

0 of 6 done

When not to animate

  • Background motion behind text. It makes reading hard. Keep it still.
  • Auto-playing video with sound. It startles people and drains data. Let people press play.
  • Any flashing effect, like a strobe. Skip it. The risk is not worth it.

Module 5 quiz

Quiz: Module 5 check: motion graphics

  1. 01What are motion graphics best at?

    Choose one.

  2. 02Why should on-screen text work with the sound off?

    Choose one.

  3. 03What does the CSS rule prefers-reduced-motion do?

    Choose one.

  4. 04What is the WCAG limit for flashing?

    Choose one.

  5. 05When should you NOT use motion? Choose all that apply.

    Choose all that apply.

Go deeper: Motion Graphics That Move the Needle

Ask. Answer. Build together.