diff --git a/packages/components/src/font-size-picker/index.js b/packages/components/src/font-size-picker/index.js index bf4c33566f68e..b06d0a536c38c 100644 --- a/packages/components/src/font-size-picker/index.js +++ b/packages/components/src/font-size-picker/index.js @@ -7,6 +7,7 @@ import { map } from 'lodash'; * WordPress dependencies */ import { __ } from '@wordpress/i18n'; +import { withInstanceId } from '@wordpress/compose'; /** * Internal dependencies @@ -16,8 +17,16 @@ import BaseControl from '../base-control'; import Button from '../button'; import Dropdown from '../dropdown'; import RangeControl from '../range-control'; +import { NavigableMenu } from '../navigable-container'; -export default function FontSizePicker( { fontSizes = [], fallbackFontSize, value, onChange, withSlider } ) { +function FontSizePicker( { + fallbackFontSize, + fontSizes = [], + instanceId, + onChange, + value, + withSlider, +} ) { const onChangeValue = ( event ) => { const newValue = event.target.value; if ( newValue === '' ) { @@ -28,10 +37,12 @@ export default function FontSizePicker( { fontSizes = [], fallbackFontSize, valu }; const currentFont = fontSizes.find( ( font ) => font.size === value ); + const labelId = `components-font-size-picker-label-${ instanceId }`; return (
) } - renderContent={ () => map( fontSizes, ( { name, size, slug } ) => ( - - ) ) } + renderContent={ () => ( + + { map( fontSizes, ( { name, size, slug } ) => ( + + ) ) } + + ) } /> { ! withSlider && ); } + +export default withInstanceId( FontSizePicker );