-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 schema: fix styles.background
definition
#59595
Conversation
Flaky tests detected in 9192442. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/8157326424
|
### background | ||
|
||
Background styles | ||
|
||
| Property | Type | Props | | ||
| --- | --- |--- | | ||
| backgroundImage | string, object | | | ||
| backgroundPosition | string, object | | | ||
| backgroundRepeat | string, object | | | ||
| backgroundSize | string, object | | | ||
|
||
--- | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, if we update the JSON schema correctly, the background section will be missing from the documentation 😅 This is because the script that generates the documentation relies only on stylesProperties
and does not consider which level the properties are available.
We may need to make major changes to the logic of the script, or the overall design of the JSON schema, to ensure that it also generates the documentation correctly.
Personally, I think it's better not to have a background property at this point, because if there is a background property in the document, there is a risk of misunderstanding that this property is available at all levels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. Thanks for noticing this detail!
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The background property is defined as a subproperty of stylesProperties. However, the stylesProperties is also used at the block/element level.
The plan is to allow background a lower levels in the not-too-distant future, but this change makes sense for now and can be reverted later when support is there.
### background | ||
|
||
Background styles | ||
|
||
| Property | Type | Props | | ||
| --- | --- |--- | | ||
| backgroundImage | string, object | | | ||
| backgroundPosition | string, object | | | ||
| backgroundRepeat | string, object | | | ||
| backgroundSize | string, object | | | ||
|
||
--- | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. Thanks for noticing this detail!
@ramonjd Thanks for the review! |
Follow-up #59354
What?
This PR fixes the following two issues regarding the
background
property, which can only be defined at the top level of thestyles
property.Considered a disallowed property:
Can be unintentionally defined at block/element level:
Why?
The
background
property is defined as a subproperty ofstylesProperties
. However, thestylesProperties
is also used at the block/element level.How?
Moved the
background
property definition directly under thestyles
property.Testing Instructions
Create a JSON file like the one below locally and make sure that the
background
property is only allowed at the top level.Screenshots or screencast
4a5a3d161e265e1414cef326e3f031f0.mp4