From 85dce58d109ee823f95019fa169f6fcc37468ee3 Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Wed, 22 Dec 2021 19:47:48 +0200 Subject: [PATCH] [Block Editor]: Restrict delete multi selected blocks shortcut --- .../block-editor/src/components/block-tools/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/block-editor/src/components/block-tools/index.js b/packages/block-editor/src/components/block-tools/index.js index d77b94b655e2d..e4d4c589a160b 100644 --- a/packages/block-editor/src/components/block-tools/index.js +++ b/packages/block-editor/src/components/block-tools/index.js @@ -95,6 +95,17 @@ export default function BlockTools( { } else if ( isMatch( 'core/block-editor/delete-multi-selection', event ) ) { + /** + * Check if the target element is a text area, input or + * event.defaultPrevented and return early. In all these + * cases backspace could be handled elsewhere. + */ + if ( + [ 'INPUT', 'TEXTAREA' ].includes( event.target.nodeName ) || + event.defaultPrevented + ) { + return; + } const clientIds = getSelectedBlockClientIds(); if ( clientIds.length > 1 ) { event.preventDefault();