Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add useReducedMotion compatibility for Safari 13 and older #2300

Merged
merged 4 commits into from
Jul 9, 2024

Conversation

BenHodgsonR2R
Copy link
Contributor

@BenHodgsonR2R BenHodgsonR2R commented Jul 1, 2024

Why

Currently, calling useReducedMotion on a Safari browser older than v14 causes an error, crashing the app.
This pull request adds compatibility checks, so that useReducedMotion can be called on older devices without producing an error.

Resolves #2299

What

Adds truthy checks to MediaQueryList.addEventListener before attempting to call the function. This function is undefined on older browsers.

Checklist

  • Ready to be merged

Copy link

changeset-bot bot commented Jul 1, 2024

🦋 Changeset detected

Latest commit: 5fd17bb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@react-spring/shared Patch
@react-spring/animated Patch
@react-spring/core Patch
@react-spring/parallax Patch
@react-spring/rafz Patch
@react-spring/types Patch
@react-spring/konva Patch
@react-spring/native Patch
@react-spring/three Patch
@react-spring/web Patch
@react-spring/zdog Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Jul 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
react-spring ✅ Ready (Inspect) Visit Preview Jul 8, 2024 11:59pm

@joshuaellis
Copy link
Member

Can you please add a changeset to the PR? 😊 otherwise looks great to me, thanks for the fix!

@BenHodgsonR2R
Copy link
Contributor Author

@joshuaellis
Thank you for taking a look at this so quickly!
Just added the changeset

joshuaellis
joshuaellis previously approved these changes Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug]: useReducedMotion: error on Safari < 14
2 participants