Skip to content

Carousel: conflict with Gutenberg Lightbox behavior #32668

Closed

Description

@liviopv

Impacted plugin

Jetpack

Quick summary

With the release of Lightbox for Image Blocks in the Gutenberg plugin, there's a conflict between Jetpack's Carousel and the core Lightbox behavior when using a core Gallery Block.

Somewhat similar to #19496 and #17484

Steps to reproduce

  1. Turn on Carousel
  2. Add a core Gallery Block
  3. In the Image Block inside the Gallery Block, select "Lightbox" in Advanced > Behaviors
  4. Open the post/page and click on the image - it will show Carousel first, and after a second click it will show GB's lightbox

A clear and concise description of what you expected to happen.

In core blocks, if I select the Lightbox behavior, it should use that instead of Carousel, as that action is more specific, since it's defined at block-level

What actually happened

Carousel was shown in the first click, and core's Lightbox after trying to exit, creating a confusing experience

Impact

Some (< 50%)

Available workarounds?

Yes, easy to implement

Platform (Simple and/or Atomic)

Simple, Atomic, Self-hosted

Logs or notes

WordPress 6.3, Gutenberg 16.5

Activity

  1. added
    Bug
    [Feature] Carousel
    [Plugin] Jetpack
    Needs triage
    on Aug 24, 2023
  2. cuemarie commented on Aug 24, 2023

    @cuemarie

    📌 REPRODUCTION RESULTS

    • Tested on Simple – Replicated
    • Tested on Atomic – Replicated

    📌 FINDINGS/SCREENSHOTS/VIDEO
    Replicated on GB 16.4.0 (on simple) and GB 16.5.0 (on AT). I believe the Image Block > Lightbox feature was released in an early 16.x update, so unclear if this is a new issue or just one that hasn't come up quite yet.

    Atomic

    CbTTxT.mp4

    📌 ACTIONS

  3. removed
    Needs triage
    on Aug 24, 2023
  4. added
    [Focus] Compatibility
    on Aug 29, 2023
  5. jeherve commented on Aug 29, 2023

    @jeherve
    Member

    TIL about the Lightbox feature in Gutenberg!

    It was introduced in WordPress/gutenberg#50373

    I'm not sure what should be our approach with this. Looking at Gutenberg's implementation, I would personally think that Jetpack's Carousel feature is more interesting, it offers more features and works better with multiple images. Maybe we should opt to disable Gutenberg's implementation when the Carousel feature is enabled.

    I think we may be able to rely on the WP_Block_Supports class here, or maybe on the filter added here:
    https://github.com/WordPress/gutenberg/blob/676f25961bfab695bacb5dd7ebb10443e49bce23/lib/block-supports/behaviors.php#L28-L35

    @artemiomorales I see you worked on the initial implementation of the Lightbox. I'd be curious to have your take on this; do you think third-party plugins should be disabling Gutenberg's Lightbox when they offer a similar feature?

  6. 17 remaining items

  7. mrfoxtalbot commented on Jan 17, 2024

    @mrfoxtalbot

    Thank you so much, @jeherve and @michalczaplinski for looking into this.

  8. michalczaplinski commented on Jan 18, 2024

    @michalczaplinski

    I also thought that using the PHP filter might do the trick but to no avail 😕:

    function filter_metadata_registration( $settings, $metadata ) {
    	if ($metadata['name'] === 'core/image') {
    		 return array_merge($metadata, array(
            	"lightbox" => array(
                	"allowEditing" => false
            	)
        	));
    	}
        return $metadata;
    };
    
    add_filter( 'block_type_metadata_settings', 'filter_metadata_registration', 5, 2 );
  9. annezazu commented on Mar 12, 2024

    @annezazu
    Collaborator

    I just ran into this on my nomad.blog simple site on WPCOM:

    Screen.Recording.2024-03-12.at.9.14.09.AM.mov

    Why aren't we finding ways to work with Core here and to ensure they work well together?

  10. simison commented on Mar 12, 2024

    @simison
    Member

    I'm afraid there is no "easy" and declarative way to disable the lightbox.

    @michalczaplinski I'd be interested in ways to disable the Gutenberg lightbox (alongside Jetpack lightbox) for posts Jetpack sends as emails to subscribers.

    JS functionality simply doesn't work in emails obviously, but there's button/link added to the markup that we now need to hide via CSS, while ideally we'd just disable markup getting added entirely via PHP. We'd disable only at runtime when rendering the email.

  11. jeherve commented on Mar 12, 2024

    @jeherve
    Member

    Related discussion: p1710260245886189-slack-CBG1CP4EN

    Related Gutenberg issue: WordPress/gutenberg#59797

  12. added a commit that references this issue on Mar 25, 2024
    5f52767
  13. added a commit that references this issue on Mar 28, 2024
    972ec82
  14. djcowan commented on Apr 10, 2024

    @djcowan

    Apologies for dumping this here randomly.
    Carousel functionality may conflict with Wordpress 6.5 "Expand on click"
    Reference gutenberg/issues/55407
    Not sure if I shoud create a new issue and on which repository it belongs

  15. jeherve commented on Apr 10, 2024

    @jeherve
    Member

    @djcowan Thanks for the warning. Right now, Jetpack's Carousel feature, when enabled, disables the Lightbox feature provided by WordPress Core. We've done that to avoid conflicts between the 2 features. However, it sounds like you may have found a conflict anyway.

    Do you think you could create a new issue here with more details explaining how to reproduce the issue, so we can take a closer look?

    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugCustomer Report [LEGACY]Triaged[Feature Group] Editor Experience[Feature] Carousel[Focus] Compatibility[Platform] Atomic[Platform] Simple[Plugin] Jetpack[Pri] Normal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions