-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Parallax no longer working with iOS 12.2 — Safari #266
Comments
same... |
Error messages would be helpful, don't have all too much time currently. |
I don't think there are any. It is something with Safari. I tested on Chrome on both devices described above and the effects still work, therefore I assume the issue is coming from the new iOS update. |
I only have Simulator which doesn't allow you to test gyroscope features but am receiving no messages in the console at all. Tested on iPhone 7, iPhone X and iPhone 6. Works fine on older iPhone (12.0.1) |
No error message makes things harder. I can try and test some things out this weekend, but no promises. It's always Apple causing the most work with this library :/ |
@reneroth Understandable dude. If I had the skill and knowledge I would try to help. |
https://www.macrumors.com/2019/02/04/ios-12-2-safari-motion-orientation-access-toggle/
=/ |
I can confirm that activating the feature described above solves the issue — iPhone XR iOS 12.2 This is a real bummer. |
probably moves this in the "unfixable" category though. |
Yup, but the Readme will need adjusting. Maybe there is a way to detect this feature and prompt the user to activate. |
W3C thread about prompting users to give permission (doesn't seem to be working as of yet): w3c/deviceorientation#57 |
This code my be a bit specific to my project, but as a workaround to this change I've used the following to implement a fallback if the user's gyroscope is disabled:
|
@neajul I looked through that thread and got lost. Does iOS now show a prompt for access to the gyroscope when needed by a site? @mradzwilla What does your fallback do? |
@gitguys Mine just adds scrolling parallax on individual items so they transform as the user scrolls. It's not the same as with the gyroscope, but it still gives the feel that items are floating.
|
@mradzwilla thank you for the explanation. This link below is apparently a working demo to prod iOS users to turn on access to the gyroscope, I think? https://elegant-dryosaurus.glitch.me Found it here in comments - https://medium.com/p/74fc9d6cd140/responses/show I don't have access to iOS 10.3, are you able to see if it works and could be implemented with Parallax? I've also noticed the paralax demo site circular info button doesn't work with Firefox on Mac nor Windows for a long time now. Is that an easy fix or is it sometihng to do with Parallax at its core somehow? http://matthew.wagerfield.com/parallax/ The circular info button works with every other browser all all platforms, but not Firefox. |
Hi everyone! var canvas = document.getElementById("c");
canvas.onclick = function() {
var recanvas = document.getElementById("c");
recanvas.onclick = function() {
return false;
};
askPermission();
};
function askPermission() {
if (typeof DeviceMotionEvent.requestPermission === "function") {
DeviceOrientationEvent.requestPermission()
.then(response => {
if (response == "granted") {
window.addEventListener(
"deviceorientation",
onDeviceOrientationChangeEvent,
false
);
location.reload();
}
})
.catch(console.error);
}
} and this is the React adaptation I'm using right now: askPermission() {
// feature detect
if (typeof DeviceOrientationEvent.requestPermission === "function") {
DeviceOrientationEvent.requestPermission()
.then(permissionState => {
if (permissionState === "granted") {
window.addEventListener("deviceorientation", () => {});
}
})
.catch(console.error);
} else {
// handle regular non iOS 13+ devices
}
}
render() {
// We'll need two divs at 50% vw and 100% vh, margin 0, fixed position
return (
<div className="App">
<canvas
className="fullScreen"
ref={el => (this.canvas = el)}
onClick={this.askPermission}
/>
</div>);
} Hope I've helped somebody out! |
So since it doesn't work on iOS unless getting permission, and as some might UX wise not want to ask the user for gyroscope settings just for enabling a purely aesthetic minor "nice to have" addition perhaps an option should be built to make the plugin not respond to the gyroscope but to touch or scroll on iOS? @reneroth Thanks for a really nice plugin otherwise! Works seamlessly on android and so easy implementation. A shame Apple has made the gyroscope permission locked. Best, |
@reneroth? 😄 |
added information to readme at least :) |
I just realised the effect is not working on Safari iOS 12.2. Tested on iPhone XR and iPad Mini 3. Can anyone replicate that?
The text was updated successfully, but these errors were encountered: