diff --git a/packages/block-library/src/heading/heading-level-dropdown.js b/packages/block-library/src/heading/heading-level-dropdown.js index f326fc138b321..394116b706f4a 100644 --- a/packages/block-library/src/heading/heading-level-dropdown.js +++ b/packages/block-library/src/heading/heading-level-dropdown.js @@ -51,7 +51,10 @@ export default function HeadingLevelDropdown( { selectedLevel, onChange, } ) { - const instanceId = useInstanceId( HeadingLevelDropdown ); + const helpTextId = useInstanceId( + HeadingLevelDropdown, + 'block-library-heading__heading-level-dropdown__help' + ); const getLevelValidity = useHeadingLevelValidator( clientId ); @@ -127,11 +130,11 @@ export default function HeadingLevelDropdown( { }, }; } ) } - aria-describedby={ `block-library-heading__heading-level-dropdown__help-${ instanceId }` } + aria-describedby={ helpTextId } />

diff --git a/packages/block-library/src/heading/use-heading-level-validator.js b/packages/block-library/src/heading/use-heading-level-validator.js index 945604a18cbd2..d30bbe64d87ca 100644 --- a/packages/block-library/src/heading/use-heading-level-validator.js +++ b/packages/block-library/src/heading/use-heading-level-validator.js @@ -78,7 +78,7 @@ export default function useHeadingLevelValidator( currentBlockClientId ) { )[ 0 ]; const hasTitle = isTitleSupported && titleIsNotEmpty && titleNode; const hasMultipleH1 = useMemo( - () => headings.filter( ( { level } ) => level === 1 ).length > 1, + () => headings.some( ( { level } ) => level === 1 ), [ headings ] );