diff --git a/packages/components/src/menu-item/index.tsx b/packages/components/src/menu-item/index.tsx index cc57d23e585a10..2eb5c46fe6cc9b 100644 --- a/packages/components/src/menu-item/index.tsx +++ b/packages/components/src/menu-item/index.tsx @@ -3,6 +3,7 @@ */ import type { ForwardedRef } from 'react'; import clsx from 'clsx'; +import { v4 as uuidv4 } from 'uuid'; /** * WordPress dependencies @@ -32,18 +33,32 @@ function UnforwardedMenuItem( isSelected, role = 'menuitem', suffix, - ...buttonProps + ...restProps } = props; className = clsx( 'components-menu-item__button', className ); + const buttonProps = { ...restProps }; if ( info ) { + const labelId = `menu-item-label-${ uuidv4() }`; + const descriptionId = `menu-item-description-${ uuidv4() }`; + children = ( - { children } - { info } + + { children } + + + + { info } + ); + + buttonProps[ 'aria-labelledby' ] = labelId; + buttonProps[ 'aria-describedby' ] = descriptionId; } if ( icon && typeof icon !== 'string' ) {