PhotoSwipe icon indicating copy to clipboard operation
PhotoSwipe copied to clipboard

PhotoSwipe opens gallery with wrong zoom level and position on Iphone when initial page zoom level > 1

Open xxxxxxbox opened this issue 2 years ago • 3 comments

Thanx for great app.

I'd like to report about an issue on mobile phones which could probably be a bug.

For example, I'll use a gallery on the main page of your site https://photoswipe.com/

I open a web page on mobile and then press on image thumb to show gallery.

  1. If initial PAGE zoom level before starting gallery is equal 1, then gallery opens correctly. Gallery is centered on the screen and displayed full screen.
  2. If initial PAGE zoom level before starting gallery is greater than 1, gallery opens with wrong position and zoom level. Only corner of gallery is visible.
  3. If initial PAGE zoom level before starting gallery is much greater than 1, gallery opens outside of visible area. Only black screen is visible.

When gallery is opened with wrong position and zoom level there is no way to center or zoom out it. When I try to center or zoom out gallery with my fingers gallery closes.

Usually, web page text and elements look small on mobiles, so users zoom in some page area at first and then start gallery. In this scenario PhotoSwipe will always open gallery with wrong position and zoom level.

Please consider changing gallery behavior on mobile phones so that gallery always opens full screen and positioned at the center of the visible area not depending on initial zoom level of PAGE.

Tested on Iphone8, IOS 15.6. PhotoSwipe 5.3.5 / 5.3.6. Please find enclosed screenshots.

phsw-1

phsw-2

phsw-3

phsw-4

xxxxxxbox avatar Feb 24 '23 13:02 xxxxxxbox

This is a known issue, you can't do much about it, since browsers do not have API to reset the zoom level. Since PhotoSwipe can be closed via gestures like a pinch or vertical swipe the user should never get trapped if this happens.

It is possible to circumvent it by scaling and repositioning PhotoSwipe viewport based on page zoom, but it brings a different set of problems with performance, coordinates, and toolbars. So I don't feel like it's worth it.

You can also do a redirect to reset the page zoom and only then open PhotoSwipe if it's critical for you.

dimsemenov avatar Mar 06 '23 06:03 dimsemenov