itsdouges/element-motion

Add ability to turn motion off with reduced motion CSS

itsdouges opened this issue · 0 comments

See: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion

Add to this line https://github.com/element-motion/element-motion/blob/master/packages/utils/src/Motion/index.tsx#L308

// utils/src/lib/accessibility.tsx
export const isReducedMotion = () => {  
  const { matches } = window.matchMedia('(prefers-reduced-motion: reduce)');
  return matches;
};

// utils/src/Motion/index.tsx
if (!isReducedMotion()) {
  ...
}