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

Custom Block, theme.json definitions not loaded with latest RC Gutenberg Plugin #43679

Closed
SGr33n opened this issue Aug 29, 2022 · 8 comments
Closed
Assignees
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

@SGr33n
Copy link

SGr33n commented Aug 29, 2022

Description

Hi,
I'm just trying the latest Gutenberg RC and I can see that something is not working anymore.
The issue is that I created a custom excerpt block, called theme/single-post-excerpt and I added some css to the theme.json:

"theme/single-post-excerpt": { "typography": { "lineHeight": "var(--wp--custom--typography--line-height--small)", "fontSize": "var(--wp--preset--font-size--large)", "fontWeight": "500" } }

That definitions works good on the latest WP 6.0.1 but if I install the latest Gutenberg RC they are ignored.

Step-by-step reproduction instructions

Create a custom block.
Add css definitions for that block on the theme.json
Check if they are applied.

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

@talldan talldan added [Status] Needs More Info Follow-up required in order to be actionable. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Aug 30, 2022
@talldan
Copy link
Contributor

talldan commented Aug 30, 2022

Hi @SGr33n, would you be able to provide some more detailed steps for reproduction. Either fuller code snippets that a developer can paste, or a link to another repo/plugin that has the problem. Thanks.

@SGr33n
Copy link
Author

SGr33n commented Aug 30, 2022

Hi @talldan!
Sure, how can I send you my code?
Or I could enable you on a staging environment with this issue already on.

@t-hamano
Copy link
Contributor

I was able to reproduce it.

Test Code

plugins/my-custom-block/src/index.js

import { registerBlockType } from '@wordpress/blocks';
import { useBlockProps } from '@wordpress/block-editor';
import metadata from './block.json';

registerBlockType( metadata.name, {
	edit: () => <p { ...useBlockProps() }>My Custom  Block</p>,
	save: () => <p { ...useBlockProps.save() }>My Custom Block</p>,
} );

plugins/my-custom-block/src/block.json

{
	"apiVersion": 2,
	"name": "create-block/test-block",
	"title": "My Custom Block",
	"category": "text",
	"textdomain": "test-block",
	"editorScript": "file:./index.js"
}

themes/twenty-twenty-two/theme.json

{
	"version": 2,
	"styles": {
		"blocks": {
			"core/heading": {
				"border": {
					"width": "3px",
					"color": "#f00",
					"style": "solid"
				},
				"color": {
					"text": "#fff",
					"background": "#000"
				}
			},
			"create-block/test-block": {
				"border": {
					"width": "3px",
					"color": "#f00",
					"style": "solid"
				},
				"color": {
					"text": "#fff",
					"background": "#000"
				}
			}
		}
	}
}

My test results show that when I activate the latest Gutenberg, the styles defined in theme.json aren't applied to the custom block only on the front-end.

d3401bd253dff73a7de297ef614c1343.mp4

@SGr33n
Copy link
Author

SGr33n commented Sep 11, 2022

@t-hamano exactly what happened to me.

@t-hamano
Copy link
Contributor

@SGr33n
Thank you for the reply.
I believe #44053 will fix this issue.

@t-hamano t-hamano self-assigned this Sep 11, 2022
@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended and removed [Status] Needs More Info Follow-up required in order to be actionable. labels Sep 11, 2022
@t-hamano
Copy link
Contributor

On behalf of #44053, #44018 will fix this issue.

@t-hamano
Copy link
Contributor

@SGr33n
This issue should have been resolved by #44018, so I would like to close this issue.
If you have any issues, please feel free to reopen.

@SGr33n
Copy link
Author

SGr33n commented Sep 14, 2022

Sure, thanks @t-hamano !

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.

3 participants