willnguyen1312 / zoom-image

A little yet powerful framework agnostic headless library to zoom images on the web
https://willnguyen1312.github.io/zoom-image/
MIT License
292 stars 8 forks source link

Long press on mobile seems to interfere with zoom #302

Closed arobbins closed 3 weeks ago

arobbins commented 3 weeks ago

Describe the bug

While zooming on mobile, if you "long press" the image it will sometimes zoom and other times open the phone's default image options. This can be quite frustrating when you're simply expecting the image to zoom only.

I've recorded a video of the bug below from my iPhone 11 on Safari.

https://github.com/willnguyen1312/zoom-image/assets/961947/01c56489-4722-4423-b141-f5858508b54b

https://github.com/willnguyen1312/zoom-image/assets/961947/1888ce0f-b727-4590-a35f-1d25ddf63603

Whether or not you explicitly restrict the phone's native image function is debatable I guess.

Would it be better to provide a "zoom icon" that overlays the image for mobile instead? That way the user can click the icon and begin the zoom, which would solve for the ambiguous expectations. I think it would be appropriate to restrict the native phone functionality at that point.

Reproduction

See above

Used Package Manager

npm

Validations

willnguyen1312 commented 3 weeks ago

Hi Andrew. It's funny that I found similar thing while solved this issue https://github.com/willnguyen1312/zoom-image/issues/299 of yours. I believed it's a native feature of mobile phone to let users download image to their phone's storage by hard-press / long-press. Normal press won't face this issue 😃

Whether or not you explicitly restrict the phone's native image function is debatable I guess.

I'm absolutely with you on this. I didn't touch this area since it belongs to users' space. As a library author, I typically aim for maximum flexibility instead of restriction toward developers :)

I will give it some digging today after work. Thanks so much for your work on creating an issue with your thoughts :)

willnguyen1312 commented 3 weeks ago

I've recorded a video of the bug below from my iPhone 11 on Safari.

Same phone and browser on my end too. I inherited the phone from my wife when she upgraded her phone to 13 model lol

arobbins commented 3 weeks ago

I've recorded a video of the bug below from my iPhone 11 on Safari.

Same phone and browser on my end too. I inherited the phone from my wife when she upgraded her phone to 13 model lol

Haha exact same situation as me! I appreciate your hard work Nam. Looking forward to hearing more.

willnguyen1312 commented 3 weeks ago

Hi Andrew, I just shipped a new option called disabledContextMenu to zoom image move. By default, it's false. If you turn it on, it will prevent zoomed image from being right-clicked / long-pressed to open context menu which is the reason why zoom experience has got disrupted. You can adjust this value on whichever devices / situations you serve. Please try it out and give me feedback. Thanks 😊

arobbins commented 3 weeks ago

Confirmed fixed. Thanks a million!