francoischalifour / medium-zoom

🔎🖼 A JavaScript library for zooming images like Medium
https://medium-zoom.francoischalifour.com
MIT License
3.58k stars 160 forks source link

data-zoom-src not working with loading attribute #185

Closed NYPD closed 2 years ago

NYPD commented 2 years ago

Bug description

When zooming into an image that has a data-zoom-src and a loading="lazy" attribute, the webpage becomes unresponsive and stuck.

How to reproduce

This is easily reproducible if you have caching turned off (open dev tools and enable the "disable cache" option). It should also happen all the time if the browser has not cached/downloaded the data-zoom-src image before

  1. Click on a image that contains a data-zoom-src and a loading="lazy" attribute with a data-zoom-src image that has not been cached yet

Here is a gif of what happens in action (the webpage becomes stuck and needs to be refreshed):

jiff

Reproducible example

Link to the bug reproduction

Environment

laurenz-glueck commented 1 year ago

@NYPD @francoischalifour Is just came across this issue and noticed it was fixed a few months but not released yet. Would one of you two mind to create a new release with this fix? Thanks! :)

NYPD commented 1 year ago

@laurenz-glueck

I in the mean time just used a modified version of medium-zoom with my fix. You can check out my commit fix and copy and paste the one line of code to get it working until @francoischalifour gets a official build out. (You will have to self host/ manually include the javascript.)

laurenz-glueck commented 1 year ago

@NYPD Thanks for your fast response! I could do it that way but I would rather just update the package via npm...

Do you have a rough ETA for the next release?

NYPD commented 1 year ago

It's up to @francoischalifour to create an official release, I'm just a random dude who submitted a pull request. I guess you could fork this repo and submit your own package in npm with the fix included.

francoischalifour commented 1 year ago

🎉 This fix was released in v1.0.7.

Sorry that it took this long to release. I got local dependency issues on my new laptop which put off the release. I should invest in triggering the release from the CI.