From f31f6279e0b432af43300830dddf556077819c41 Mon Sep 17 00:00:00 2001 From: Felix Arntz Date: Thu, 16 Jan 2025 15:34:07 -0800 Subject: [PATCH] Try using popover API for image lightbox. --- packages/block-library/src/image/index.php | 11 +++-- packages/block-library/src/image/style.scss | 28 ++++++----- packages/block-library/src/image/view.js | 51 +++++++++++++++++---- 3 files changed, 65 insertions(+), 25 deletions(-) diff --git a/packages/block-library/src/image/index.php b/packages/block-library/src/image/index.php index 697f67a927fc8..304f026e49d21 100644 --- a/packages/block-library/src/image/index.php +++ b/packages/block-library/src/image/index.php @@ -213,7 +213,7 @@ function block_core_image_render_lightbox( $block_content, $block ) { // Sets an event callback on the `img` because the `figure` element can also // contain a caption, and we don't want to trigger the lightbox when the // caption is clicked. - $p->set_attribute( 'data-wp-on-async--click', 'actions.showLightbox' ); + $p->set_attribute( 'data-wp-on--click', 'actions.showLightbox' ); $p->set_attribute( 'data-wp-class--hide', 'state.isContentHidden' ); $p->set_attribute( 'data-wp-class--show', 'state.isContentVisible' ); @@ -226,12 +226,13 @@ function block_core_image_render_lightbox( $block_content, $block ) { $button = $img[0] . '