jetpack
jetpack copied to clipboard
Jetpack Carousel: Lightbox breaks with lazyload
Steps to reproduce the issue
- Go to https://www.insposa.co.uk/bridal-fashion/wedding-dresses/our-10-favourite-wedding-dresses-from-the-meadow-collection-by-katya-katya-london/
- Click on an image inside the gallery block slightly further down the page
- Lightbox won't work due to JavaScript error
What I expected
Lightbox to work
What happened instead
Lightbox breaks due to lazy load code changing the image HTML output to perform the lazy load. I'm imagining Jetpack adds the orig-size attribute too late or via JS.
Ultimately, trying to open the lightbox leads to this JavaScript error:
Uncaught TypeError: Cannot read property 'split' of undefined
This error happens at:
.data("orig-size").split(",")
There should be a check for that attribute first and a fallback to get the image width if it doesn't exist.
Thanks for the report. This is something that may be addressed by this PR: #20010
If you get the chance, do not hesitate to give it a try, and let us know if that fixes the problem for you!