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

Custom select control: don't announce external value changes #22815

Merged
merged 8 commits into from
Jun 18, 2020
9 changes: 7 additions & 2 deletions packages/components/src/font-size-picker/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* External dependencies
*/
import memoize from 'memize';

/**
* WordPress dependencies
*/
Expand Down Expand Up @@ -26,7 +31,7 @@ function getSelectValueFromFontSize( fontSizes, value ) {
return DEFAULT_FONT_SIZE;
}

function getSelectOptions( optionsArray, disableCustomFontSizes ) {
const getSelectOptions = memoize( ( optionsArray, disableCustomFontSizes ) => {
optionsArray = [
{ slug: DEFAULT_FONT_SIZE, name: __( 'Default' ) },
...optionsArray,
Expand All @@ -39,7 +44,7 @@ function getSelectOptions( optionsArray, disableCustomFontSizes ) {
name: option.name,
style: { fontSize: option.size },
} ) );
}
} );

export default function FontSizePicker( {
fallbackFontSize,
Expand Down