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

Theme.json: CSS variables are not generated for non-latin slugs in the iframed editor #49711

Open
Tracked by #57309
t-hamano opened this issue Apr 11, 2023 · 8 comments
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 [Type] Enhancement A suggestion for improvement.

Comments

@t-hamano
Copy link
Contributor

t-hamano commented Apr 11, 2023

Description

In theme.json, if the value of the slug property contains a non-latin language, all CSS variables will not be loaded into the iframe editor instance. I have confirmed that it occurs with the settings.color.palette[].slug property, but it may occur with all slug properties.

This property has the following description in the JSON schema:

Kebab-case unique identifier for the color preset.

However, the user will not know why this occurs because the code editor will not show a validation error no matter what value is set.

I propose both of the following approaches to remedy this problem:

Step-by-step reproduction instructions

In the block theme, update theme.json as follows:

{
	"$schema": "https://schemas.wp.org/trunk/theme.json",
	"version": 2,
	"settings": {
		"color": {
			"palette": [
				{
					"color": "#101010",
					"name": "Custom",
					"slug": "custom-カラー"
				}
			]
		}
	}
}

When you open the site editor, the root document outputs all the CSS variables:

root-body


However, all CSS variables aren't generated in the iframe editor instance:

non-latin


The browser console outputs the following error:

error


If all the slugs are correct, the CSS variable should output as follows:

latin

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@t-hamano t-hamano added Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json Good First Issue An issue that's suitable for someone looking to contribute for the first time labels Apr 11, 2023
@Faizan711
Copy link

Hey @t-hamano is this issue assigned to anyone, if not i would live to get assigned and solve it.

@t-hamano
Copy link
Contributor Author

@Faizan711
Thanks for your interest. I have assigned you.

@abhi3315
Copy link
Contributor

abhi3315 commented May 8, 2023

What's the status of this issue? I would like to contribute to it.

@t-hamano
Copy link
Contributor Author

t-hamano commented May 9, 2023

@abhi3315
Thank you for your interest in this issue.

@Faizan711, who has already been assigned to this issue, may be working on this issue. Can I reassign @abhi3315 to work on this issue if you are not already working on this issue?

@Faizan711
Copy link

sorry for the delay @t-hamano , I am unable to fix the issue due to my semester exams.
Sure, you can assign it to @abhi3315

@abhi3315
Copy link
Contributor

abhi3315 commented May 9, 2023

No problem @Faizan711
Best of luck for your exam. I can continue working on this issue.

@t-hamano t-hamano assigned abhi3315 and unassigned Faizan711 May 9, 2023
@t-hamano
Copy link
Contributor Author

Hi @abhi3315,

Can you afford to address this issue? If it is difficult, feel free to tell me 👍

@abhi3315
Copy link
Contributor

Hey @t-hamano

I tried to fix this issue but I got occupied with other things. Sorry, I forgot to mention it. Please feel free to reassign it to someone else.

Thanks!

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 [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

4 participants