diff --git a/packages/block-editor/src/components/block-rename/modal.js b/packages/block-editor/src/components/block-rename/modal.js index 8e9ffc1d81b63..f3db0d6c36252 100644 --- a/packages/block-editor/src/components/block-rename/modal.js +++ b/packages/block-editor/src/components/block-rename/modal.js @@ -8,9 +8,8 @@ import { TextControl, Modal, } from '@wordpress/components'; -import { useInstanceId } from '@wordpress/compose'; import { __, sprintf } from '@wordpress/i18n'; -import { useState } from '@wordpress/element'; +import { useState, useId } from '@wordpress/element'; import { speak } from '@wordpress/a11y'; /** @@ -23,8 +22,12 @@ export default function BlockRenameModal( { originalBlockName, onClose, onSave, + // Pattern Overrides is a WordPress-only feature but it also uses the Block Binding API. + // Ideally this should not be inside the block editor package, but we keep it here for simplicity. + hasOverridesWarning, } ) { const [ editedBlockName, setEditedBlockName ] = useState( blockName ); + const descriptionId = useId(); const nameHasChanged = editedBlockName !== blockName; const nameIsOriginal = editedBlockName === originalBlockName; @@ -34,11 +37,6 @@ export default function BlockRenameModal( { const autoSelectInputText = ( event ) => event.target.select(); - const dialogDescription = useInstanceId( - BlockRenameModal, - `block-editor-rename-modal__description` - ); - const handleSubmit = () => { const message = nameIsOriginal || nameIsEmpty @@ -66,14 +64,10 @@ export default function BlockRenameModal( { title={ __( 'Rename' ) } onRequestClose={ onClose } overlayClassName="block-editor-block-rename-modal" - aria={ { - describedby: dialogDescription, - } } focusOnMount="firstContentElement" + aria={ { describedby: descriptionId } } + size="small" > -
- { __( 'Enter a custom name for this block.' ) } -