godaddy-wordpress / coblocks

A suite of professional page building content blocks for the WordPress Gutenberg block editor.
https://wordpress.org/plugins/coblocks/
GNU General Public License v2.0
749 stars 145 forks source link

The lightbox does not work with lazy loading #1421

Closed florianbrinkmann closed 4 years ago

florianbrinkmann commented 4 years ago

Describe the bug:

A user of my lazy loading plugin reported (https://wordpress.org/support/topic/plugin-compatibility-coblocks-gallery-lightbox/) that there are problems using it with CoBlocks’ lightbox for, for example, the offset gallery block.

I took a look into the code and the issue seems to be that on load the img elements are scraped for the src attribute values, to store them in a variable. But at that point, the src holds the placeholder data uri from my plugin, so the lightbox tries to display that instead of the image that gets loaded later.

To reproduce:

  1. Install and activate Lazy Loader (https://wordpress.org/plugins/lazy-loading-responsive-images/) and CoBlocks.
  2. Create an offset gallery with the lightbox feature enabled.
  3. View the frontend and try the lightbox.
  4. See error.

Expected behavior:

Correct displaying of the image :)

Isolating the problem:

WordPress version:

5.4 RC2-47460

AnthonyLedesma commented 4 years ago

@florianbrinkmann Thank you for this report. I have a PR up that should fix this bug here: #1486. If you have time to test out the branch fix/lazy-load-lightbox We would appreciate it.