primefaces / primevue

Next Generation Vue UI Component Library
https://primevue.org
MIT License
9.04k stars 1.11k forks source link

Core: Animations respect `prefers-reduced-motion` OS setting #4974

Open melloware opened 7 months ago

melloware commented 7 months ago

Using animations on the web in the most accessible way requires a little extra consideration:

In general, it's best to use animations on the web in a complementary way rather than the only way to note a state change in UI. Remember to update the text of actions and change elements' other visual aspects too!

And when it comes to an animation's timing and duration, avoid changing the state of something at a rate of three times per second or greater - which can trigger photosensitive epilepsy.

All included animations now support and leverage the prefers-reduced-motion CSS media feature (opens new window)to detect if a user has requested that the system minimize the amount of non-essential motion it uses.

When a prefers-reduced-motion is set to reduce, it indicates that the user prefers less motion, which may trigger discomfort for those with vestibular motion disorders on the page.

image

mertsincan commented 7 months ago

Thanks @melloware, is there any PR for it? :)

melloware commented 7 months ago

@mertsincan so i didn't take a deep dive into PrimeVue/React yet but a couple of things can be done with CSS Media Queries:

PrimeIcons: https://github.com/primefaces/primeicons/issues/1065

PrimeFlex: https://github.com/primefaces/primeflex/issues/198

Then we need to look in PrimeVue and see anywhere animations are triggered and disable them when reduced motion is on?

const isAnimationDisabled = useMatchMedia(`(prefers-reduced-motion: reduce)`);
mertsincan commented 5 months ago

I set a milestone for it. We'll check before the milestone is released.