Who is Eeva-Jonna?

Why We Need Reduced Motion?

Who Benefits From Reduced Motion?

And Who Doesn't?

Problematic Movement

Factors, that can make the movement or animation problematic:

These are based on Val Head's article on A List Apart, here's a link: Val Head - Designing Safer Web Animation For Motion Sensitivity

Reducing Motion in Action

prefers-reduced-motion Media Feature

In Media Queries level 5 specification, there is a media feature called prefers-reduced-motion. It is still a draft, but the support is good, all the other browsers except IE.

CSS

.animated-content {
  animation: 3s linear 1s infinite alternate slidein;
}

@media screen and (prefers-reduced-motion: reduce) {
  .animated-content {
    animation: fade 0.5s ease-in both;
  }
}

JavaScript

const prefersReducedMotion = 
      window.matchMedia('(prefers-reduced-motion)')

const reduceMotionChanges = () => {
  if (pefersReducedMotion.matches) {
    // Handle reduced motion
  }
}

prefersReducedMotion.addListener(reduceMotionChanges)

GIFs

HTML-version

<picture>
  <source
    srcset="path-to-gif"
    media="(prefers-reduced-motion: no-preference)" />
  <img
    src="path-to-img"
    alt="This Alt-text describes 
         all the images within picture" />
</picture>

A Play GIF-button with React

const GifWithPlayButton = () => {
 const [play, setPlay] = useState(false)
 const prefersReducedMotion = usePrefersReducedMotion()
 const handleClick = () => setPlay(!play)
 const text = play ? "Pause" : "Play"
 retun (
  <section>
      <h2>With controls</h2>
      {prefersReducedMotion && 
        <button onClick={handleClick}>{text}</button>
      }
      <picture>
        {!play && (
          <source 
           srcSet="firstFrame.gif" 
           media="(prefers-reduced-motion)" />
        )}
        <img
          src="catSewing.gif"
          alt={
            `A cat sewing yellow-green cloth 
            with a sewing machine.`
          }
        />
      </picture>
    </section>)
}

If you're interested in a demo I did about GIFs and prefers-reduced-motion, it was on React Finland - Vodcast 2 (Accessibility). It explains these concepts a bit deeper, with live coding.

Resources