We can use the media query prefers-reduced-motion
to detect a user's preference for motion. This is particularly useful when we have users that may have vestibular disorders. In these cases, we can detect it and set motion speed to zero.
Instructor: [0:00] Our tic-tac-toe board currently uses motion on the page, and this might not be suitable for all users. To detect this, we can use the media query prefers-reduced-motion. In our demo, all motion is powered by this drawSpeed variable. When you use the prefers-reduced-motion, we can set the drawSpeed to seconds.
[0:19] Now when we check our demo, it still works as before, but using the rendering panel of DevTools, we can emulate prefers-reduced-motion. If we reload our page, there's no motion to draw any of the elements.
[0:32] In review, we can use the media query prefers-reduced-motion to detect our users' preferences for motion. These users may have vestibular disorders and would prefer no motion at all or reduced motion. In those cases, we can do things such as reduce motion duration to seconds.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!