Skip to content

Commit

Permalink
Add vw and vh units to the custom font size picker (#60607)
Browse files Browse the repository at this point in the history
Add vw and vh to the list of default units in the font size picker.

Co-authored-by: carolinan <poena@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>
Co-authored-by: geriux <geriux@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
Co-authored-by: richtabor <richtabor@git.wordpress.org>
  • Loading branch information
9 people authored May 23, 2024
1 parent c043b8e commit b122a98
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

### Enhancements

- `FontSizePicker`: Add `vw` and `vh` units to the default units in the font size picker ([#60507]((https://github.com/WordPress/gutenberg/pull/60607)).
- `PaletteEdit`: Use consistent spacing and metrics. ([#61368](https://github.com/WordPress/gutenberg/pull/61368)).
- `FormTokenField`: Hide label when not defined ([#61336](https://github.com/WordPress/gutenberg/pull/61336)).
- `ComboboxControl`: supports disabled items ([#61294](https://github.com/WordPress/gutenberg/pull/61294)).
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/font-size-picker/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function FontSizePicker( {
const label = __( 'Font Size' );

const units = useCustomUnits( {
availableUnits: [ 'px', 'em', 'rem' ],
availableUnits: [ 'px', 'em', 'rem', 'vw', 'vh' ],
} );

const accessibilityLabel = sprintf(
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/font-size-picker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import FontSizePickerSelect from './font-size-picker-select';
import FontSizePickerToggleGroup from './font-size-picker-toggle-group';
import { T_SHIRT_NAMES } from './constants';

const DEFAULT_UNITS = [ 'px', 'em', 'rem' ];
const DEFAULT_UNITS = [ 'px', 'em', 'rem', 'vw', 'vh' ];

const UnforwardedFontSizePicker = (
props: FontSizePickerProps,
Expand Down Expand Up @@ -112,7 +112,7 @@ const UnforwardedFontSizePicker = (
units
);
const isValueUnitRelative =
!! valueUnit && [ 'em', 'rem' ].includes( valueUnit );
!! valueUnit && [ 'em', 'rem', 'vw', 'vh' ].includes( valueUnit );
const isDisabled = value === undefined;

return (
Expand Down

1 comment on commit b122a98

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in b122a98.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9202841112
📝 Reported issues:

Please sign in to comment.