diff --git a/package-lock.json b/package-lock.json index b1a0b613c6afd..53d6ef595199e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19700,6 +19700,7 @@ "@wordpress/element": "file:packages/element", "@wordpress/i18n": "file:packages/i18n", "@wordpress/icons": "file:packages/icons", + "@wordpress/keycodes": "file:packages/keycodes", "@wordpress/notices": "file:packages/notices", "@wordpress/url": "file:packages/url", "lodash": "^4.17.21" diff --git a/packages/reusable-blocks/package.json b/packages/reusable-blocks/package.json index 8acebdbb869a7..ea87a85f86c03 100644 --- a/packages/reusable-blocks/package.json +++ b/packages/reusable-blocks/package.json @@ -37,6 +37,7 @@ "@wordpress/element": "file:../element", "@wordpress/i18n": "file:../i18n", "@wordpress/icons": "file:../icons", + "@wordpress/keycodes": "file:../keycodes", "@wordpress/notices": "file:../notices", "@wordpress/url": "file:../url", "lodash": "^4.17.21" diff --git a/packages/reusable-blocks/src/components/reusable-blocks-menu-items/reusable-block-convert-button.js b/packages/reusable-blocks/src/components/reusable-blocks-menu-items/reusable-block-convert-button.js index ab7d8b12e4416..ad4e4f3c26d0b 100644 --- a/packages/reusable-blocks/src/components/reusable-blocks-menu-items/reusable-block-convert-button.js +++ b/packages/reusable-blocks/src/components/reusable-blocks-menu-items/reusable-block-convert-button.js @@ -20,6 +20,7 @@ import { useDispatch, useSelect } from '@wordpress/data'; import { __ } from '@wordpress/i18n'; import { store as noticesStore } from '@wordpress/notices'; import { store as coreStore } from '@wordpress/core-data'; +import { BACKSPACE } from '@wordpress/keycodes'; /** * Internal dependencies @@ -143,6 +144,12 @@ export default function ReusableBlockConvertButton( { label={ __( 'Name' ) } value={ title } onChange={ setTitle } + onKeyDown={ ( event ) => { + const { keyCode } = event; + if ( keyCode === BACKSPACE ) { + event.stopPropagation(); + } + } } />