Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use "prefers-reduced-motion" media query to disable animations #1652

Open
thejimbirch opened this issue Oct 4, 2021 · 5 comments
Open

Use "prefers-reduced-motion" media query to disable animations #1652

thejimbirch opened this issue Oct 4, 2021 · 5 comments

Comments

@thejimbirch
Copy link
Contributor

To turn animations off, you could write a prefers-reduced-motion media query. Then anyone who wants to turn animations off can do so in thue browser/OS settings.

This is from WCAG 2.1 Animations from interactions success criterion, level-AAA.

Discussed in Drupal Issue 2312805 . Drupal previously used jQuery Joyride, and has switched to Shepherd.

@RobbieTheWagner
Copy link
Member

@thejimbirch you can override scrollTo on the step to change the scrolling behavior if that's what you mean?

@thejimbirch
Copy link
Contributor Author

Thanks for the quick reply!

I like the scrolling. But some users do not.

Was reading the doc at Mozilla about this type of media query is the best of both worlds. Keeps it as a default, but lets users opt out if they so choose.

@RobbieTheWagner
Copy link
Member

@thejimbirch do you know of a good way to use that with scrollIntoView?

@thejimbirch
Copy link
Contributor Author

thejimbirch commented Oct 5, 2021

This article has a nice example for implementing in JavaScript.

const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
mediaQuery.addEventListener('change', () => {
  console.log(mediaQuery.media, mediaQuery.matches);
  // Stop JavaScript-based animations.
});

https://web.dev/prefers-reduced-motion/

And a demo at the bottom of the article.

@mgifford
Copy link

mgifford commented Dec 8, 2021

This is an important accessibility issue for folks with VIMS. Nobody wants to become sick from browsing the web.

More links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants