Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make font size dropdown more accessible. #33941

Merged
merged 8 commits into from
Aug 12, 2021
2 changes: 2 additions & 0 deletions packages/components/src/custom-select-control/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export default function CustomSelectControl( {
className,
hideLabelFromVision,
label,
describedBy,
ntsekouras marked this conversation as resolved.
Show resolved Hide resolved
options: items,
onChange: onSelectedItemChange,
value: _selectedItem,
Expand Down Expand Up @@ -120,6 +121,7 @@ export default function CustomSelectControl( {
'aria-labelledby': undefined,
className: 'components-custom-select-control__button',
isSmall: true,
describedBy: describedBy ? describedBy : undefined,
alexstine marked this conversation as resolved.
Show resolved Hide resolved
} ) }
>
{ itemToString( selectedItem ) }
Expand Down
3 changes: 3 additions & 0 deletions packages/components/src/font-size-picker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ function FontSizePicker(

const selectedFontSizeSlug = getSelectValueFromFontSize( fontSizes, value );

const currentFontSizeSR = `Currently selected font size: ${ options.find( ( option ) => option.key === selectedFontSizeSlug ).name }`;

return (
<fieldset
className="components-font-size-picker"
Expand All @@ -103,6 +105,7 @@ function FontSizePicker(
<CustomSelectControl
className={ 'components-font-size-picker__select' }
label={ __( 'Font size' ) }
describedBy={ currentFontSizeSR }
options={ options }
value={ options.find(
( option ) => option.key === selectedFontSizeSlug
Expand Down