Skip to content
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

Workaround webkit disrespecting e.preventDefault() #6450

Merged
merged 1 commit into from
Apr 3, 2018

Conversation

anandthakker
Copy link
Contributor

@jfirebaugh
Copy link
Contributor

Let's just bind both touchstart and touchmove aggressively everywhere. I'm done with passive event listers.

// Bind touchmove with passive: false on iOS because, even though
// onTouchMove only fires a map event, binding with passive: true causes
// iOS not to respect e.preventDefault() in _other_ handlers, even if they
// are non-passive. https://bugs.webkit.org/show_bug.cgi?id=182521
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the right WebKit bug URL?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, I must have copied from the wrong tab, thanks.

@anandthakker
Copy link
Contributor Author

@jfirebaugh updated

DOM.addEventListener(el, 'touchstart', onTouchStart, {passive: false});
DOM.addEventListener(el, 'touchmove', onTouchMove, {passive: true}); // `passive: true` because onTouchMove only sends a map event.
DOM.addEventListener(el, 'touchmove', onTouchMove, {passive: false});

DOM.addEventListener(el, 'touchend', onTouchEnd); // The real action is in DragPanHandler and TouchZoomRotateHandler.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the comment here.

@anandthakker anandthakker merged commit 02ed387 into release-0.45 Apr 3, 2018
@anandthakker anandthakker deleted the safari-grrrr branch April 3, 2018 19:53
chrisvoll added a commit to seatgeek/mapbox-gl-js that referenced this pull request Apr 23, 2018
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.

2 participants