PhotoSwipe icon indicating copy to clipboard operation
PhotoSwipe copied to clipboard

Chrome iOS can cause zoom with one finger

Open bakura10 opened this issue 2 years ago • 4 comments

Hi,

We had a user of one of our theme (which relies on PhotoSwipe for zooming) a strange issue that happens exclusively on Chrome iOS (Safari does not exhibit the issue).

It is a bit complex to explain, so I will attach a video, but to reproduce the issue you have to:

  1. Open the zoom.
  2. Maintain a long tap on the image to show contextual menu.
  3. Close the contextual menu.
  4. Move your finger.

Instead of moving the image, it will actually zoom. This is also reproducible on the library demo.

https://github.com/dimsemenov/PhotoSwipe/assets/1198915/abaa36ff-dbc9-4f7e-b9ab-9fca5564561d

Thanks :)

bakura10 avatar Sep 26 '23 07:09 bakura10

Odd issue, I'll look into it. It's possible to disable the context menu by calling preventDefault on pointerdown, but that's not ideal.

dimsemenov avatar Sep 27 '23 03:09 dimsemenov

Thanks a lot for investigating this issue :)

bakura10 avatar Sep 27 '23 03:09 bakura10

Fought with this for half of a day. It seems in the new iOS Chrome update neither pointerup nor pointercancel is called when the context menu disappears. Pointer-capture also doesn't help, and lostpointercapture event never fires.

The Firefox on IOS does seem to work correctly.

I'm not sure yet what to do, as the only thing that helps is disabling the context menu via something like:

lightbox.on('bindEvents', () => {
  lightbox.pswp.scrollWrap.ontouchstart = (e) => e.preventDefault();
});

The other thing that helps also is switching from pointer events back to old touch events API. With touch events touchend does fire right before the next touchstart.

dimsemenov avatar Sep 29 '23 08:09 dimsemenov

Thanks for spending time on this. We should open a bug tracker to Chrome. I think you have more context about the issue than I have, can you please try to open one ? Otherwise I will try to do it myself :)

bakura10 avatar Sep 29 '23 09:09 bakura10