motion
motion copied to clipboard
[FEATURE] Replace deprecated window.matchMedia.addListener with proper method
Is your feature request related to a problem? Please describe.
Standing on this page, window.matchMedia.addListener is a deprecated method and could be removed at any time
Describe the solution you'd like This method should be replaced in favour of EventTarget.addEventListener()
In packages/framer-motion/src/utils/reduced-motion/index.ts
- motionMediaQuery.addListener(setReducedMotionPreferences)
+ motionMediaQuery.addEventListener("change",setReducedMotionPreferences)
Describe alternatives you've considered The method could be wrapped in a try/catch construct, to avoid run-time errors on browser where it's not supported
Are there any updates on this?
Need to check if addEventListener exists.
ios13 MediaQueryList.prototype.addEventListener is not defined