I recently learned about the prefers-reduced-motion
CSS media query. In a nutshell, if a user enables reduced motion on their device/browser, the CSS styles within this media query will be applied.
For example, if buttons have animations when they’re clicked like this:
| |
We can disable those animations if a user has enabled reduced motion on their device by using the prefers-reduced-motion media query like this:
| |
Technically, the CSS being applied under prefers-reduced-motion doesn’t need to be related to motions or animations. It’s possible to do other things, like changing the background color, if a user prefers reduced motion. So something like this is possible too:
| |
The Mozilla docs cover how to enable reduced motion on several browsers: