diff --git a/packages/components/src/font-size-picker/stories/index.story.tsx b/packages/components/src/font-size-picker/stories/index.story.tsx index f6502fcfd537c..59af0f5cfe60d 100644 --- a/packages/components/src/font-size-picker/stories/index.story.tsx +++ b/packages/components/src/font-size-picker/stories/index.story.tsx @@ -18,6 +18,10 @@ const meta: Meta< typeof FontSizePicker > = { component: FontSizePicker, argTypes: { value: { control: false }, + units: { + control: 'inline-check', + options: [ 'px', 'em', 'rem', 'vw', 'vh' ], + }, }, parameters: { actions: { argTypesRegex: '^on.*' }, diff --git a/packages/components/src/unit-control/utils.ts b/packages/components/src/unit-control/utils.ts index 0a7c1160d0b38..c80b34ef3af7b 100644 --- a/packages/components/src/unit-control/utils.ts +++ b/packages/components/src/unit-control/utils.ts @@ -394,7 +394,7 @@ export function filterUnitsWithSettings( // Although the `isArray` check shouldn't be necessary (given the signature of // this typed function), it's better to stay on the side of caution, since // this function may be called from un-typed environments. - return Array.isArray( availableUnits ) && Array.isArray( allowedUnitValues ) + return Array.isArray( availableUnits ) ? availableUnits.filter( ( unit ) => allowedUnitValues.includes( unit.value ) )