rpearce / react-medium-image-zoom

🔎 🏞 The original medium.com-inspired image zooming library for React (since 2016)
https://rpearce.github.io/react-medium-image-zoom/
BSD 3-Clause "New" or "Revised" License
1.88k stars 100 forks source link

Pressing back button in browser after zooming an image breaks body scroll #421

Closed walmsles closed 1 year ago

walmsles commented 1 year ago

Issue Type

Description

After clicking on the image to enable zoom, when the back button is pressed, the browser goes back to the previous page, but scrolling on the body is not re-enabled. Unable to scroll HTML body until the browser is refreshed.

Place detailed information here: Using in simple uncontrolled mode to zoom images (which works great - I like it). Except the back button press causes the HTML body not to be scrollable.

rpearce commented 1 year ago

@walmsles Nice find! I'd love to collect a little more info:

walmsles commented 1 year ago

Happy to answer (FE is very complicated, isn't it):

Let me know how else I can help.

Effectively with NextJS13 - I have wrapped Next/Image with the following - via react-markdown and remark to add to the layers:

     <Zoom
            zoomImg={{
                src: src ||'',
                width: "100%",
                loading: "lazy",
            }}
       >
            <NextImage 
                src={src || ''}
                className={className}
                width={500}
                height={312}
                alt={alt || 'un-named blog article Image'}
            >
            </NextImage>
        </Zoom>
rpearce commented 1 year ago

Thanks! That should give me enough to go on to try to reproduce it and fix it.

rpearce commented 1 year ago

This was super easy to reproduce and fix thanks to your information! https://github.com/rpearce/react-medium-image-zoom/pull/422

I'll add you to the all contributors list for your bug report, and I'll report back here when the next path version is published in a moment.