question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not working with iOS 11.3 Mobile Safari

See original GitHub issue

It looks like the workaround

window.addEventListener( 'touchmove', function() {});

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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14

github_iconTop GitHub Comments

5reactions
reppnerscommented, Mar 30, 2018

Turns out the same workaround still applies but because Safari on iOS 11.3 enables passive event listener support it defaults to passive: true for event listeners on document level.

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 makeItWorkOnSafari() function…

2reactions
reppnerscommented, Mar 31, 2018

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 document.addEventListener() would be interpreted either as capture parameter or something else unintended happens.

To correctly apply the different workarounds you now have to check for passive event listener support and act accordingly

if(supportsPassive) {
  window.addEventListener('touchmove', function () { }, {passive: false});
}
else {
  window.addEventListener( 'touchmove', function() { });
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

iOS 11 Safari Not Working on iPhone 6/6S/7/7 Plus? Fixed Here!
7 Tips to fix Safari not working in iOS 11 on iPhone 6/6S/7/7 Plus · 1. Close and launch Safari again · 2....
Read more >
Top 12 Ways to Fix Safari Not Working on iPhone and iPad
1. Restart iPhone or iPad · 2. Turn off Safari Suggestions · 3. Edit Your Screen Time Settings · 4. Check Cellular Settings...
Read more >
Safari Not Working On iPhone? Here's The Fix.
What's Really Causing The Problem? · Close And Reopen Safari · Clear Safari History And Website Data · Restart Your iPhone · Update...
Read more >
Safari Not Working On iPhone? Try These Tips To Fix It
When Safari starts misbehaving on an iPhone, with random crashes or websites that never load properly, there are several possible solutions.
Read more >
Top 11 Fixes for Safari Not Working on iPhone and iPad
1. Closing Your Safari Tabs. The first thing to try to fix Safari not working on your iPhone or iPad is to close...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found