From dc5980468ee20da4c84d4018ab109dd0b4976cb4 Mon Sep 17 00:00:00 2001 From: Jerry Jones Date: Mon, 30 Sep 2024 15:12:22 -0500 Subject: [PATCH 1/2] Fix focus loss when deleting selected block in zoom out mode --- .../block-editor/src/components/block-tools/zoom-out-toolbar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/block-tools/zoom-out-toolbar.js b/packages/block-editor/src/components/block-tools/zoom-out-toolbar.js index b8736de11481a..7b7de71698464 100644 --- a/packages/block-editor/src/components/block-tools/zoom-out-toolbar.js +++ b/packages/block-editor/src/components/block-tools/zoom-out-toolbar.js @@ -135,7 +135,6 @@ export default function ZoomOutToolbar( { clientId, __unstableContentRef } ) { } __unstableSetEditorMode( 'edit' ); resetZoomLevel(); - __unstableContentRef.current?.focus(); } } /> ) } @@ -147,6 +146,7 @@ export default function ZoomOutToolbar( { clientId, __unstableContentRef } ) { label={ __( 'Delete' ) } onClick={ () => { removeBlock( clientId ); + __unstableContentRef.current?.focus(); } } /> ) } From bf5393db366dab8e5e9cd42b75a5cb85e0f49e0e Mon Sep 17 00:00:00 2001 From: Jerry Jones Date: Tue, 1 Oct 2024 09:45:18 -0500 Subject: [PATCH 2/2] Fix accidental removal --- .../block-editor/src/components/block-tools/zoom-out-toolbar.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/block-editor/src/components/block-tools/zoom-out-toolbar.js b/packages/block-editor/src/components/block-tools/zoom-out-toolbar.js index 7b7de71698464..f2c073117d2ce 100644 --- a/packages/block-editor/src/components/block-tools/zoom-out-toolbar.js +++ b/packages/block-editor/src/components/block-tools/zoom-out-toolbar.js @@ -135,6 +135,7 @@ export default function ZoomOutToolbar( { clientId, __unstableContentRef } ) { } __unstableSetEditorMode( 'edit' ); resetZoomLevel(); + __unstableContentRef.current?.focus(); } } /> ) }