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

"vh" unit is not available in the unit control when added in theme.json #31700

Closed
carolinan opened this issue May 11, 2021 · 1 comment · Fixed by #31822
Closed

"vh" unit is not available in the unit control when added in theme.json #31700

carolinan opened this issue May 11, 2021 · 1 comment · Fixed by #31822
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended

Comments

@carolinan
Copy link
Contributor

Description

When support for custom units is enabled in theme.json using this format:

{
	"version": 1,
	"settings": {
		"spacing": {
			"customPadding": true,
			"units": [ "px", "em", "rem", "vh", "vw" ]
		}
	}
}

then the vh is not available in the unit control in the editors.
The other units are available.

Step-by-step reproduction instructions

  1. Add the code above to a theme.json file in a theme.
  2. In either editor, add a block that has support for custom padding like a group block or cover.
  3. Select the padding control and see that vh is missing.

Expected behaviour

I expect the unit to be selectable.

Actual behaviour

It is not selectable.


vh in the unit control:
https://github.com/WordPress/gutenberg/blob/trunk/packages/components/src/unit-control/utils.js#L36

And vh support for cover block:
https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/cover/shared.js#L55

WordPress information

  • WordPress version: 5.7.1
  • Gutenberg version: trunk
  • Are all plugins except Gutenberg deactivated? yes
  • Are you using a default theme (e.g. Twenty Twenty-One)? TT1 Blocks

Device information

  • Device: desktop
  • Operating system: windows 10
  • Browser: Chrome Version 90.0.4430.212
@carolinan carolinan added the Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json label May 11, 2021
@carolinan carolinan added the [Type] Bug An existing feature does not function as intended label May 11, 2021
@aristath
Copy link
Member

It looks like all CSS_UNITS values are currently hardcoded in all packages, investigating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants