Don't log Device Orientation as an error
sumanthratna opened this issue Β· comments
π Issue/Bug Report Template
Describe the bug
When devices don't support gyroscope/device orientation, there's an error in the console. It'd be nice to try/catch this and instead log a warning.
To Reproduce
Steps to reproduce the behavior:
- Launch a parallax site with gyroscope enabled
- Open developer console
- See error
Expected behavior
Instead of logging an error, log as a warning in development mode (and maybe don't log anything in production?)
Link to demo (highly encouraged)
- http://hacktj.org/2021/ (in around a month, we're going to redo the site so the error will probably go away HackTJ/2021@13eb1f6)
- https://mkosir.github.io/react-parallax-tilt/?path=/story/react-parallax-tilt--gyroscope-tilt (ideally, eventually this will get fixed so the error will go away)
Code snippets
If applicable, add code samples to help explain your problem.
Environment
- Browser: Safari 14.0 (16610.1.15.51.2) on macOS Big Sur (10.16; not Apple Silicon)
- Version: "react-parallax-tilt": 1.4.56
Additional context
n/a
Hi @sumanthratna, thanks for the feedback!
Nice suggestion, I agree with showing a warning only in development mode.
Would you like to take a stab at this and create PR?
Sure! I just created a PRβlet me know if you think this warrants a note in the README under https://github.com/mkosir/react-parallax-tilt#props.
Looks great, thanks for the PR