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 > Styles > Typography > textAlign breaks text alignment options in the block toolbar #62685

Open
carolinan opened this issue Jun 20, 2024 · 2 comments · May be fixed by #62260
Open
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

I searched but was not able to find an open issue for this.
I was trying to understand how the new textAlignment typography style and settings worked.

With Gutenberg trunk on 6.6 beta 3, if I set a default alignment to a text based block like the site title using theme.json, then I can not change the alignment using the block toolbar.

The CSS that sets the default seems to have a higher specificity and overrides the has-text-align CSS:

:root :where(.wp-block-site-title) {
    text-align: center;
}
.has-text-align-right {
    text-align: right; 
}

Step-by-step reproduction instructions

Activate Gutenberg.
Activate Twenty Twenty-Four.
Open theme.json replace the styles section with

	"styles": {
		"blocks": {
			"core/site-title": {
				"typography": {
					"textAlign": "center"
				}
			}
		}
	},

Open the Site Editor and insert a new Site Title block.
Confirm that the text in the block is centered.
Try adjusting the alignment to left or right using the option in the block toolbar.
Confirm that the alignment does not change.

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

@carolinan carolinan added the [Type] Bug An existing feature does not function as intended label Jun 20, 2024
@bph bph added the Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json label Jun 20, 2024
@talldan
Copy link
Contributor

talldan commented Jun 20, 2024

@carolinan I saw there's a PR (#62260) from @t-hamano that might address the issue, though I haven't looked too closely!

@t-hamano
Copy link
Contributor

Thanks for the ping. #62260 should solve exactly this issue.

@t-hamano t-hamano linked a pull request Jun 20, 2024 that will close this issue
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.

4 participants