Chrome iOS can cause zoom with one finger
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:
- Open the zoom.
- Maintain a long tap on the image to show contextual menu.
- Close the contextual menu.
- 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 :)
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.
Thanks a lot for investigating this issue :)
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.
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 :)