react-image-magnify icon indicating copy to clipboard operation
react-image-magnify copied to clipboard

Small image width and height attributes missing

Open matthewlein opened this issue 4 years ago • 1 comments

To avoid Cumulative Layout Shift, I would like width and height attributes set on the small img. Makes sense to me to use the existing width and height options.

I imagine it would be something along the lines of

...
width: smallImg.width,
height: smallImg.height
...

here: https://github.com/ethanselzer/react-image-magnify/blob/master/src/ReactImageMagnify.js#L331-L341

matthewlein avatar Apr 27 '21 16:04 matthewlein

Hi @matthewlein I've forked the project and added support here: https://www.npmjs.com/package/@blacklab/react-image-magnify

As a note, I'm still working through some bugs that resulted in the rewrite. If you use this library and encounter any, please report them as issues in my github repo so I can address them.

Thanks!

gooftroop avatar Sep 16 '21 19:09 gooftroop