Update Theme JSON $schema
to account for pseudo selector support
#41936
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
In #41786 we added pseudo selector support to Theme JSON. We now need to update the
schema
for Theme JSON so we get accurate feedback in code editors such as Visual Studio Code.When working on this PR you might like to reference: https://json-schema.org/understanding-json-schema/
Why?
We need good develop experience
How?
Update the schema for
elements
both at the top level and inside blocks to know about the validpseudo
selectors -:hover
,:focus
, and:active
on thelink
element only.Note that this introduces some duplication in under the
stylesElementsPropertiesComplete.properties.link.allOf[1].properties
object whereis effectively duplicating
stylesPropertiesComplete
.@adamziel and I spent some time trying to work out a way to DRY this up, but the way
additionalProperties
locks things down for extension seems to preclude the possibility of achieving this.In the future as more elements start to allow pseudo elements we may need to DRY the schema up more but for now this is good enough.
Testing Instructions
theme.json
file and update the$schema
to point to your local Gutenberg version do the schema file (e.g."$schema": "file:///Users/{{YOUR_USER}}/Sites/gutenberg/schemas/json/theme.json"
).elements.link
and{{BLOCK_NAME}}.elements.link
and check your IDE doesn't complain to you.link
and check it complains.Screenshots or screencast