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 moving a zoomed viewport around #8659

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

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 (ignore issue 8658 if it happens at this stage)
  2. Use one finger to drag and move the visual viewport around left and right

Make sure that the zoom is high enough (i.e. the layout viewport is much bigger than the visual viewport) and that you test all three scenarios:

2.a. Make one single dragging motion (e.g. to the left) such that during the whole motion from beginning to end, you are dragging the visual viewport
2.b. Make one single dragging motion such that, when you start, you are dragging the viewport; then, while you are moving, the visual viewport reaches the limit that it can't move past - e.g., if you are dragging left, the right border of the visual viewport comes to touch the right border of the layout viewport and any further movement of your finger can't move the viewport further, so it stops, but you keep dragging; so the second half of your dragging motion has no effect
2.c. After that, when the layout viewport is moved all the way to the left, or in other words the visual viewport is all the way to the right, do one other whole drag motion with the finger towards the left, as if to attempt to move the layout further, which you can't do, so the whole of your movement is actually a "swipe" that doesn't move anything.

Expected:
2.a should NEVER trigger a swipe event
2.b. should NEVER trigger a swipe event
2.c. should trigger a swipe event

Observed:
2.b systematically trigger a swipe event, at least when you get past the point where you can't keep dragging the viewport, but your dragging motion continues. That's understandable, meaning an understandable mistake, yet a mistake.
2.a sometimes triggers a swipe event. I'd say most of the time it doesn't. It seems utterly random. That's complete nonsense
2.c. triggers a swipe event, that's as expected.

Overall, the swipe events are pathetically unreliable and effectively unusable.

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