Skip to content

[FEATURE] Replace deprecated window.matchMedia.addListener with proper method #2823

@doctorstones

Description

@doctorstones

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions