Checks if the user has enabled the "reduced motion" accessibility preference
Queries the prefers-reduced-motion media query to determine if animations and transitions should be minimized for accessibility (WCAG 2.1 compliance).
True if user prefers reduced motion
if (isPreferredReducedMotion()) { // Skip animations element.classList.add('no-animation');} else { // Use full animations element.classList.add('with-animation');} Copy
if (isPreferredReducedMotion()) { // Skip animations element.classList.add('no-animation');} else { // Use full animations element.classList.add('with-animation');}
Checks if the user has enabled the "reduced motion" accessibility preference
Queries the prefers-reduced-motion media query to determine if animations and transitions should be minimized for accessibility (WCAG 2.1 compliance).