-
Notifications
You must be signed in to change notification settings - Fork 148
Not working with iOS 11.3 Mobile Safari #124
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. 8000
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
Comments
Confirmed. Relates to #77 Could only find this: I'll take a look if the detection for passive event listeners works for iOS 11.3 - if it does already apply |
Turns out the same workaround still applies but because Safari on iOS 11.3 enables passive event listener support it defaults to The fix is simple: window.addEventListener('touchmove', function () { }, {passive: false}) But this puts the burden of feature detection of passive event listeners on the polyfill user. Maybe I should put this into another augmentation module so people who need to support Safari just import and apply a single |
Thank you for the fast response and I can confirm that it works! 🎉
I don't actually understand the workaround but is there anything that I have to worry/think about when using this? The "burden" you've mentioned, I don't understand what you mean by that. I guess I would have to read up on passive event listeners and their feature detection. 😅 |
If you need to support older browsers (e.g. previous Safari) the third parameter on To correctly apply the different workarounds you now have to check for passive event listener support and act accordingly
|
All right, thank you! For anyone stumbling upon this issue and wants to know how to get // Test via a getter in the options object to see if the passive property is accessed
var supportsPassive = false;
try {
var opts = Object.defineProperty({}, 'passive', {
get: function() {
supportsPassive = true;
}
});
window.addEventListener("testPassive", null, opts);
window.removeEventListener("testPassive", null, opts);
} catch (e) {} Source: https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection |
Hi guys, |
Please provide exact failure description, code regarding the workaround and polyfill configuration. |
Is that some type-checker complaining or who does raise the error? If you're targeting this code to Safari iOS11.3 than it's perfectly valid since its supporting the new addEventListener api. According to can-i-use it's supported on earlier versions, too. What has changed is that document-level listeners by default apply when I scroll and then try to drag across the screen touch move event is not triggered I'm not sure I can follow
|
Yes, this is the issue: drag starts but can't really move the draggable because the view is scrolling when you touchmove. |
Thanks for clarifying. I have an iPad at hand that is pending the update to 11.3. Will try to check locally if I can find anything helping your issue. |
Updated the iPad 2017 to iOS 11.3 and the demo works without problems. Note that I updated the gh-pages demo containing the new workaround a few minutes ago - please check if http://timruffles.github.io/mobile-drag-drop/demo/ works for you, too. |
touchEvents are not supported by safari browsers . Please check this https://developer.mozilla.org/en-US/docs/Web/API/Touch_events |
Closing as this is "solved" and referenced in the README. |
It looks like the workaround
doesn't work anymore with iOS 11.3 Mobile Safari. Is there a new workaround? 😅 It looks like that the same issue applies to Chrome on iOS as well.
The text was updated successfully, but these errors were encountered: