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

Warn on unitless zero values in theme.json #57641

Open
dsas opened this issue Jan 8, 2024 · 1 comment
Open

Warn on unitless zero values in theme.json #57641

dsas opened this issue Jan 8, 2024 · 1 comment
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Type] Enhancement A suggestion for improvement.

Comments

@dsas
Copy link
Contributor

dsas commented Jan 8, 2024

What problem does this address?

When themes declare a global padding (styles.spacing.padding) in theme.json as 0 without a unit, it results in a display issue in the overlay menu on small screen resolutions.

0 0px
image image

There's some work done in #53725 to better address padding, but it doesn't solve for the "unitless zero" case. This isn't something that can be solved easily, if at all, the calc css function is typed and so needs the type passing in.

Given the issue can't be addressed in code, it would be good to help theme authors be more aware of this problem

What is your proposed solution?

When theme.json is parsed - a warning/error could be emitted when a unit-less value is encountered in global padding (and possibly other places).

@dsas dsas added the [Type] Enhancement A suggestion for improvement. label Jan 8, 2024
@t-hamano t-hamano added the [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. label Jan 8, 2024
@ramonjd
Copy link
Member

ramonjd commented Jan 9, 2024

Font size discussion that could be related:

Many value in theme.json are declared "string" according to the schema: https://github.com/WordPress/gutenberg/blob/trunk/schemas/json/theme.json#L564

I agree that a warning could work. Type coercion might trigger unexpected bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants