Image block lightbox: setting lightbox on an image makes all following images open in the lightbox #55119
Labels
[Block] Image
Affects the Image Block
[Feature] Interactivity API
API to add frontend interactivity to blocks.
[Status] In Progress
Tracking issues with work in progress
[Type] Bug
An existing feature does not function as intended
Description
This can be reproduced also in WordPress core with Gutenberg disabled so is needs to be fixed before the 6.4 release.
Cc @annezazu @bph @mikachan @SiobhyB @karmatosed @hellofromtonya
When a post has more than one Image block, setting one of the image to open in the lightbox makes all following imges open in the lightbox, even if their lightbox setting is disabled.
This is clearly not the expected beheavior.
This filter rund at priority 15:
gutenberg/packages/block-library/src/image/index.php
Line 72 in f04f5c5
The filter is never removed. That means the lightbox markup and view file are added to all the blocks after the first block that has the lightbox enabled.
That also highlights that the lighbox feature has never been tested with more than one image, which is a little surprising.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: