From 969d1e5d1584ee3974b03a1041e4800840b8efc7 Mon Sep 17 00:00:00 2001 From: Ricardo Artemio Morales Date: Tue, 17 Oct 2023 14:57:13 -0500 Subject: [PATCH 1/7] Improve focus management This commit removes the logic to set focus differently based on event.pointerType and instead sets focus on the dialog itself when the lightbox opens, and on the lightbox trigger when the lightbox closes. --- packages/block-library/src/image/index.php | 2 ++ packages/block-library/src/image/view.js | 28 +++++++--------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/packages/block-library/src/image/index.php b/packages/block-library/src/image/index.php index dd2e72aebe5ef2..261e07c1d1f2cf 100644 --- a/packages/block-library/src/image/index.php +++ b/packages/block-library/src/image/index.php @@ -235,6 +235,7 @@ function block_core_image_render_lightbox( $block_content, $block ) { $button = $img[0] . ' - + HTML; From 6c1090ad592637367f390cfc2dce3b56aa66776c Mon Sep 17 00:00:00 2001 From: Ricardo Artemio Morales Date: Thu, 19 Oct 2023 12:40:40 -0500 Subject: [PATCH 7/7] Remove unnecessary tabindex --- packages/block-library/src/image/index.php | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/block-library/src/image/index.php b/packages/block-library/src/image/index.php index 821de4fb5ae248..69e6941b1403df 100644 --- a/packages/block-library/src/image/index.php +++ b/packages/block-library/src/image/index.php @@ -218,7 +218,6 @@ function block_core_image_render_lightbox( $block_content, $block ) { ) ); $w->next_tag( 'img' ); - $w->set_attribute( 'tabindex', '-1' ); $w->set_attribute( 'data-wp-init', 'effects.core.image.initOriginImage' ); $w->set_attribute( 'data-wp-on--load', 'actions.core.image.handleLoad' ); $w->set_attribute( 'data-wp-effect', 'effects.core.image.setButtonStyles' );