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

Schema: theme.json allows to set styles.blocks.*.spacing.blockGap #38929

Closed
ocean90 opened this issue Feb 19, 2022 · 3 comments
Closed

Schema: theme.json allows to set styles.blocks.*.spacing.blockGap #38929

ocean90 opened this issue Feb 19, 2022 · 3 comments
Labels
Developer Experience Ideas about improving block and theme developer experience [Type] Bug An existing feature does not function as intended

Comments

@ocean90
Copy link
Member

ocean90 commented Feb 19, 2022

Description

I was trying to set a default block gap styling via theme.json but that didn't work.

Example:

{
	"$schema": "https://schemas.wp.org/wp/5.9/theme.json",
	"version": 2,
	"styles": {
		"spacing": {
			"blockGap": "20px"
		},
		"blocks": {
			"core/navigation": {
				"spacing": {
					"blockGap": "8px"
				}
			}
		}
	}
}

Turns out that this isn't supported. Another related comment: #37360 (comment)

It would be nice if the schema could be adjusted to show an error if the blockGap property is set for block styles.

Step-by-step reproduction instructions

  1. Extend the theme.json from Twenty-Twenty Two with the example from above
  2. Notice that the block gap is not used, neither in the settings panel nor in the CSS output on frontend.

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

@ocean90 ocean90 added [Type] Bug An existing feature does not function as intended Developer Experience Ideas about improving block and theme developer experience labels Feb 19, 2022
@mrleemon
Copy link
Contributor

So, one cannot set a blockGap value in the styles section if blockGap is not enabled in the settings section? A theme developer would want to set a default blockGap but not let theme users change it.

@skorasaurus
Copy link
Member

skorasaurus commented Mar 2, 2023

So, one cannot set a blockGap value in the styles section if blockGap is not enabled in the settings section? A theme developer would want to set a default blockGap but not let theme users change it.

UPDATE:

You can set a BlockGap value but prevent theme users from changing it by following this example:
but instead
set the blockGap value to false;

@skorasaurus
Copy link
Member

Since this issue was made; blockGap on a per block basis was implemented In #40875

If you're having specific issue with the navigation block; please create a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Developer Experience Ideas about improving block and theme developer experience [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants