Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xxxxxxbox opened this issue Feb 24, 2023 · 1 comment
Labels

Comments

@xxxxxxbox
Copy link

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

@dimsemenov
Copy link
Owner

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 dimsemenov added the Bug label Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants