Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

swipeleft and swiperight events fire when pinch-zooming #8658

Open
teo1978 opened this issue Sep 26, 2019 · 0 comments
Open

swipeleft and swiperight events fire when pinch-zooming #8658

teo1978 opened this issue Sep 26, 2019 · 0 comments

Comments

@teo1978
Copy link

teo1978 commented Sep 26, 2019

Example code:

$(document).on("swipeleft", function(e) {
    console.log("Swipe left detected");
});
$(document).on("swiperight", function(e) {
    console.log("Swipe right detected");
});

And the viewport metatag in the html:

<meta name="viewport" content="width=device-width, initial-scale=1">

Steps to reproduce:

  1. On a real mobile device, pinch-zoom

Expected:
shouldn't ever trigger a swipe left or right event, because you are using TWO fingers. That makes it obvious that it is not a swipe gesture

Observed:
sometimes randomly triggers a swipe event while you are pinch-zooming.

I'm under the impression that you're just testing for a touch event doing a drag motion of a length and/or speed above a certain threshold, regardless of whether there are other touch points at the same time.

Instead, you should add the condition that the finger touching and dragging is the only finger present.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant