From 815915698a79578f94b89d5dee7756ff9e25f985 Mon Sep 17 00:00:00 2001 From: Aki Hamano Date: Sat, 11 Jan 2025 11:35:27 +0900 Subject: [PATCH] Group: Make nav element selectable and add UI for ariaLabel --- packages/block-library/src/group/edit.js | 45 +++++++++++++++++------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/packages/block-library/src/group/edit.js b/packages/block-library/src/group/edit.js index 352a6fbc77819e..9ab518bfbf708b 100644 --- a/packages/block-library/src/group/edit.js +++ b/packages/block-library/src/group/edit.js @@ -9,7 +9,7 @@ import { useInnerBlocksProps, store as blockEditorStore, } from '@wordpress/block-editor'; -import { SelectControl } from '@wordpress/components'; +import { SelectControl, TextControl } from '@wordpress/components'; import { useRef } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { View } from '@wordpress/primitives'; @@ -22,13 +22,13 @@ import GroupPlaceHolder, { useShouldShowPlaceHolder } from './placeholder'; /** * Render inspector controls for the Group block. * - * @param {Object} props Component props. - * @param {string} props.tagName The HTML tag name. - * @param {Function} props.onSelectTagName onChange function for the SelectControl. - * - * @return {JSX.Element} The control group. + * @param {Object} props Component props. + * @param {Object} props.attributes Block attributes. + * @param {(attributes: Object) => void} props.setAttributes Callback for updating block attributes. + * @return {JSX.Element} The control group. */ -function GroupEditControls( { tagName, onSelectTagName } ) { +function GroupEditControls( { attributes, setAttributes } ) { + const { tagName, ariaLabel } = attributes; const htmlElementMessages = { header: __( 'The
element should represent introductory content, typically a group of introductory or navigational aids.' @@ -48,6 +48,9 @@ function GroupEditControls( { tagName, onSelectTagName } ) { footer: __( 'The