Skip to content

Commit

Permalink
Fix: Clicking On Backspace Makes Reusable Block Modal Disappear
Browse files Browse the repository at this point in the history
See: #36513
  • Loading branch information
delowardev committed Dec 7, 2021
1 parent cdedab2 commit 85ec8c6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/reusable-blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -143,6 +144,12 @@ export default function ReusableBlockConvertButton( {
label={ __( 'Name' ) }
value={ title }
onChange={ setTitle }
onKeyDown={ ( event ) => {
const { keyCode } = event;
if ( keyCode === BACKSPACE ) {
event.stopPropagation();
}
} }
/>
<Flex
className="reusable-blocks-menu-items__convert-modal-actions"
Expand Down

0 comments on commit 85ec8c6

Please sign in to comment.