Skip to content

Articles · Good practices

Animations and carousels: letting people pause everything

A self-scrolling carousel, a blinking banner, a looping background video: what RGAA criterion 13.8 requires, the 5-second rule, and prefers-reduced-motion.

By

· Published on

The home page opens on a carousel that changes image every four seconds. Anyone who reads slowly sees the text change before the end of the first sentence. With an attention disorder, the movement keeps pulling the eye and the rest of the page becomes hard to read. With a screen reader, the content changes mid-reading.

What the RGAA requires

Criterion 13.8 asks: « Dans chaque page web, chaque contenu en mouvement ou clignotant est-il contrôlable par l’utilisateur ? » (On each web page, can each moving or blinking content be controlled by the user?) Its test 13.8.1 covers moving content started automatically, which must meet one of these conditions:

  • La durée du mouvement est inférieure ou égale à 5 secondes ; (the movement lasts 5 seconds or less);
  • L’utilisateur peut arrêter et relancer le mouvement ; (the user can stop and restart the movement);
  • L’utilisateur peut afficher et masquer le contenu en mouvement ; (the user can show and hide the moving content);
  • L’utilisateur peut afficher la totalité de l’information sans le mouvement. (the user can display all the information without the movement).

Test 13.8.2 applies the same conditions to blinking content. In WCAG 2.2, this is success criterion 2.2.2 Pause, Stop, Hide (Level A).

The pause-on-focus or pause-on-hover trap

Many carousels stop when focus enters them or when the mouse hovers over them, then start again. The RGAA methodology states that a pause obtained only by receiving focus is not a compliant method. It does not mention hover, which raises the same problem: the glossary requires control by keyboard and mouse, at least, that lets the user interact with the rest of the page. Yet the carousel starts again as soon as the mouse leaves it.

The most common solution is a visible “Pause” button, usable with the keyboard and the mouse, that keeps the state the person chose. Test 13.8.1 also accepts movement lasting 5 seconds or less, or a way to hide the content or display it without movement.

What about prefers-reduced-motion?

The CSS media query prefers-reduced-motion reads the system’s “reduce motion” setting. Respect it: people who are sensitive to motion, prone to dizziness or nausea, need it. It is still not enough for criterion 13.8, because not everyone bothered by a carousel has turned this setting on.

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

This code stops CSS animations and transitions. A carousel driven by JavaScript keeps turning: its script must read the same preference, with window.matchMedia('(prefers-reduced-motion: reduce)').

Our advice

  • Do not start automatic scrolling: let the person move from one slide to the next.
  • If you keep automatic scrolling, place the pause button before the carousel in the tab order.
  • For a background video, stop the loop or offer a still image. A video is time-based media: the RGAA assesses it under the Multimedia topic, criterion 4.11 in particular, rather than criterion 13.8.

Sources

  • RGAA 4.1.2, criterion 13.8, its tests and its methodology, and glossary. accessibilite.numerique.gouv.fr (in French)
  • W3C, WCAG 2.2, success criterion 2.2.2 Pause, Stop, Hide. w3.org
  • W3C, ARIA Authoring Practices Guide, Carousel Pattern. w3.org

Leave a Reply

Every comment is reviewed before it is published. Your email address will not be published. Fields marked with an asterisk (*) are required. See the privacy policy.

Read also