Skip to content

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

@changeset-bot
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

@vercel
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

@BenHodgsonR2R BenHodgsonR2R marked this pull request as ready for review July 1, 2024 07:38
@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
@joshuaellis joshuaellis merged commit a755bd8 into pmndrs:main Jul 9, 2024
@BenHodgsonR2R BenHodgsonR2R deleted the bh/safari-13-compatibility branch July 9, 2024 11:11
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