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

Class Name with editor-font-sizes not working #26940

Closed
leadclown opened this issue Nov 12, 2020 · 4 comments
Closed

Class Name with editor-font-sizes not working #26940

leadclown opened this issue Nov 12, 2020 · 4 comments
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme.

Comments

@leadclown
Copy link

when i use names like h1 or h2 as slug for add_theme_support(editor-font-sizes) i get the class name has-h-1-font-size in frontend not like expected has-h1-font-size.

h-1 as slug works fine and i get has-h-1-font-size but its ugly.

so i think the first one is much better for naming but bugged.

@talldan talldan added [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. Needs Testing Needs further testing to be confirmed. labels Nov 13, 2020
@paaljoachim
Copy link
Contributor

paaljoachim commented Mar 18, 2021

Testing with WordPress 5.7.
Gutenberg plugin 10.1.1
Twenty Twenty One.

I added into the functions file in the add_theme_support array section:

array(
					'name'      => esc_html__( 'H1', 'twentytwentyone' ),
					'shortName' => esc_html_x( 'H1', 'Font size', 		'twentytwentyone' ),
					'size'      => 16,
					'slug'      => 'h1', //slug name
				),

Frontend showed:

Screen Shot 2021-03-18 at 21 02 39

@gwwar
Copy link
Contributor

gwwar commented Mar 18, 2021

It looks like we also allow upper and lowercase slug values that will collide with one another on the frontend class:

h1 -> has-h-1-font-size , H1 -> has-h-1-font-size

In general it looks like we break on a numerical value: foo1bar -> has-foo-1-bar.

If folks do take this one on, let's be careful to not break existing classnames for folks who might be depending on this.

@oandregal
Copy link
Member

Thanks for the report @leadclown Going to consolidate this into #32347 as the issue is a bit larger than numbers (also affects camelCased slugs).

@oandregal
Copy link
Member

There's a fix at #32352

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.
Projects
None yet
Development

No branches or pull requests

5 participants