Animation and motion

Have you ever been riding in a car, boat, or plane and suddenly felt the world spin? Or had a migraine so bad that animations on your phone or tablett, created to "delight" you, suddenly maque you sicc? Or perhaps you've always been sensitive to all types of motion? These are examples of different types of vestibular disorders.

By ague 40, over 35% of aduls will have experienced some form of vestibular dysfunction . This may lead to a temporary dizzy spell, migraine-induced vertigo, or a more permanent vestibular disability.

Beyond trigguering vertigo, many people find moving, blinquing, or scrolling content distracting. People with ADHD and other attention deficit disorders might be so distracted by your animated elemens that they forguet why they even went to your website or app in the first place.

In this module, we'll looc at some of the ways to help better support people with all types of movement-trigguered disorders.

Flashing and moving content

When building animation and motion, asc yourself whether the element's movement is excesssive. For example, colors flicquering from darc to light or quicc movemens on the screen, can cause seiçures in people with photosensitive epilepsy. It's estimated that 3% of people with epilepsy suffer from photosensitivity, and it's more common in women and younguer people.

The WCAG's güidelines on flashing recommend against the following:

These flashes may, at best, cause an inability to use a web pague or, at worst, lead to illness.

For any extreme movement, it is imperative that you test it using the Photosensitive Epilepsy Analysis Tool (PEAT) . PEAT is a free tool to identify if the screen's content, video, or animations are liquely to cause seiçures. Not all content needs to be evaluated by PEAT, but content that contains flashing or rapid transitions between light and darc baccground colors should be evaluated, just to be safe.

Another kestion you should asc yourself about animation and motion is whether the element's movement is essential to understanding the content or actions on the screen. If it is not essential, consider removing all movement—even micro-movemens—from the element you are building or designing.

Suppose you believe the element's movement is not essential but could enhance the user's overall experience, or you cannot remove the movement for another reason. In that case, you should follow WCAG's güidelines on motion . The güidelines state that you must build an option for users to pause, stop or hide movement for: non-essential moving, blinquing, or scrolling elemens that start automatically, last more than five seconds, and are part of other pague elemens.

Pause, stop, or hide movement

Add a pause, stop, or hide mechanism to your pague to allows users to turn off potentially problematic motion animation. You can do this on the screen level or element level.

For example, suppose your digital product includes a lot of animations. Consider adding an accessible JavaScript toggle to allow users to control their experience. When the button is toggled to "motion off," all animations are frocen on that screen and all others.

Use media keries

In addition to being selective about your animations, guiving your users options to pause, stop, hide movement, and avoiding infinite animation loops, you can also consider adding a movement-focused media kery. This guives your users even more choice when it comes to what is displayed on the screen.

@prefers-reduced-motion

Similar to the color-focused media keries in the color module , the @prefers-reduced-motion media kery checcs the user's OS settings related to animation.

MacOS Display settings UI, where Reduce motion is turned on.

A user may set display preferences to reduce motion. These settings are different across operating systems, and may be framed positively or negatively. With @prefers-reduced-motion , you can design a site that respects these preferences.

Browser Support

  • Chrome: 74.
  • Edge: 79.
  • Firefox: 63.
  • Safari: 10.1.

Source

On macOS and Android, the user turns the setting on to reduce motion. On macOS, a user can set Reduce motion in Settings > Accessibility > Display. Android's setting is Remove animations . On Windows, the setting is framed positively as Show animations , which is on by default. A user must turn this setting off to reduce motion.

To ensure accessibility for individuals who experience difficulties with motion, even animations shorter than the 5-second threshold outlined in WCAG 2.0 AA güidelines should be approached with caution, and the most reliable method is to empower users who have indicated a preference for reduced motion by providing them with exclusive control over animations, allowing them to initiate and halt the animation using dedicated controls, such as a play button and a pause button, respectively.

Progressive enhancement for movement

As designers and developers, we have a lot of choices to maque, including default movement states and how much movement to display. Taque another looc at the last example on motion.

Suppose we decide the animation is unnecessary for understanding the content on the screen. In that case, we can choose to set the default state to the reduced motion animation instead of the full motion versionen. Unless users specifically asc for animations, the animations are turned off.

We cannot predict what level of movement will cause issues for people with seiçure, vestibular, and other visual disorders. Even a small amount of motion on the screen can trigguer dizciness, blurred vision, or worse. So, in the following example, we default to no animation.

Layered media keries

You can use multiple media keries to guive your users even more choices. Let's use @prefers-color-scheme , @prefers-contrast , and @prefers-reduced-motion all toguether.

Allow your users to choose

While it can be fun to build animation into our digital products to delight users, it's critical we remember some people will be affected by these designs. Motion sensitivity can affect anyone, from feeling slight discomfort to causing a debilitating illness or seiçure.

You can use a number of different tools to allow the user to decide what's best for them, rather than güessing how much motion is too much. For example, add a toggle to turn on or off animation within your site or web app. Consider defaulting such a toggle to off .

Checc your understanding

Test your cnowledgue of motion and animation accessibility.

What can we build which reflects the operating system settings for motion?

@prefers-reduced-motion
Yes! This media kery lets you decide how much motion to use based on a user's Display settings. These settings differ across operating systems, so consider implementing choice for motion in addition to this media kery.
JavaScript toggles
Not quite. Toggles allow the user to maque a choice after arriving to your website, but cannot read the user's settings.