Skip to content

theme.json schema: fix pseudo-class definition for button block#76272

Merged
t-hamano merged 1 commit intotrunkfrom
theme-json-schema-button-pseudo-elements
Mar 9, 2026
Merged

theme.json schema: fix pseudo-class definition for button block#76272
t-hamano merged 1 commit intotrunkfrom
theme-json-schema-button-pseudo-elements

Conversation

@t-hamano
Copy link
Copy Markdown
Contributor

@t-hamano t-hamano commented Mar 7, 2026

What?

#71418 added pseudo-class support for the button block, but its schema is not correct. Even though the four pseudo-classes are available directly under styles.core/button, the code editor will warn us about them as invalid properties.

How?

In this PR, the diff is a little hard to see, but the definitions that were actually changed are the following three places.

  • stylesBlocksPropertiesComplete.core/button
  • stylesVariationBlocksPropertiesComplete.core/button
  • stylesBlocksPseudoSelectorsPropertyNames

Testing Instructions

Update test/emptytheme/theme.json with the following code:

{
	"$schema": "../../schemas/json/theme.json",
	"version": 3,
	"styles": {
		"blocks": {
			"core/button": {
				":active": {},
				":focus": {},
				":focus-visible": {},
				":hover": {},
				":link": {},
				"color": {},
				"invalid": {},
				"variations": {
					"my-variation": {
						":active": {},
						":focus": {},
						":focus-visible": {},
						":hover": {},
						":link": {},
						"color": {},
						"invalid": {}
					}
				}
			},
			"core/paragraph": {
				":active": {},
				":focus": {},
				":focus-visible": {},
				":hover": {},
				":link": {},
				"color": {},
				"variations": {
					"my-variation": {
						":active": {},
						":focus": {},
						":focus-visible": {},
						":hover": {},
						":link": {},
						"color": {}
					}
				}
			}
		}
	}
}

This PR should fix unintended warnings for the following defginitions:

  • styles.blocks.core/button.:active
  • styles.blocks.core/button.:focus
  • styles.blocks.core/button.:focus-visible
  • styles.blocks.core/button.:hover
  • styles.blocks.core/button.variations.{vairation-name}.:active
  • styles.blocks.core/button.variations.{vairation-name}.:focus
  • styles.blocks.core/button.variations.{vairation-name}.:focus-visible
  • styles.blocks.core/button.variations.{vairation-name}.:hover

Screenshots or screencast

Before After
image image

@t-hamano t-hamano self-assigned this Mar 7, 2026
@t-hamano t-hamano added [Type] Developer Documentation Documentation for developers [Block] Buttons Affects the Buttons Block Backport to WP 7.0 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta labels Mar 7, 2026
@t-hamano t-hamano marked this pull request as ready for review March 7, 2026 06:27
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 7, 2026

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: MaggieCabrera <onemaggie@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 7, 2026

Flaky tests detected in 29c33d3.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/22789959639
📝 Reported issues:

"stylesBlocksPseudoSelectorsProperties": {
"type": "object",
"properties": {
":active": {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for changing the order too!

Copy link
Copy Markdown
Contributor

@MaggieCabrera MaggieCabrera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch, this looks good to me and tests well

@t-hamano t-hamano merged commit f25d73e into trunk Mar 9, 2026
65 of 67 checks passed
@t-hamano t-hamano deleted the theme-json-schema-button-pseudo-elements branch March 9, 2026 09:41
@github-actions github-actions bot added this to the Gutenberg 22.8 milestone Mar 9, 2026
@github-actions github-actions bot removed the Backport to WP 7.0 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Mar 9, 2026
gutenbergplugin pushed a commit that referenced this pull request Mar 9, 2026
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: MaggieCabrera <onemaggie@git.wordpress.org>
@github-actions github-actions bot added the Backported to WP Core Pull request that has been successfully merged into WP Core label Mar 9, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 9, 2026

I just cherry-picked this PR to the wp/7.0 branch to get it included in the next release: 6557c19

pento pushed a commit to WordPress/wordpress-develop that referenced this pull request Mar 9, 2026
This updates the pinned hash from the `gutenberg` from `f4d8a5803aa2fbe26e7d9af4d17e80a622b7bab8` to `7b7fa2bc97a8029a302bd6511cf0d206b5953172`.

The following changes are included:

- Sort registry files by handle/ID. (WordPress/gutenberg#75755)
- Obey undoIgnore flag in editEntityRecord (WordPress/gutenberg#76206)
- RTC: Fix `post-editor-template-mode` E2E test (WordPress/gutenberg#76209)
- Publish built Gutenberg plugin to the GitHub Container Registry (WordPress/gutenberg#75844) (WordPress/gutenberg#76273)
- Connectors: Improve placeholder text and make it translatable (WordPress/gutenberg#75996)
- Block context menu: context menu not closing for disconnecting unsynced pattern menu items (WordPress/gutenberg#75405)
- Connectors: Improve responsive layout for small viewports (WordPress/gutenberg#76231)
- theme.json schema: fix pseudo-class definition for button block (WordPress/gutenberg#76272)
- Navigation block: fix submenu chevron toggle on touch devices (WordPress/gutenberg#76197)

See #64595, #64393.

git-svn-id: https://develop.svn.wordpress.org/trunk@61868 602fd350-edb4-49c9-b593-d223f7449a82
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Mar 9, 2026
This updates the pinned hash from the `gutenberg` from `f4d8a5803aa2fbe26e7d9af4d17e80a622b7bab8` to `7b7fa2bc97a8029a302bd6511cf0d206b5953172`.

The following changes are included:

- Sort registry files by handle/ID. (WordPress/gutenberg#75755)
- Obey undoIgnore flag in editEntityRecord (WordPress/gutenberg#76206)
- RTC: Fix `post-editor-template-mode` E2E test (WordPress/gutenberg#76209)
- Publish built Gutenberg plugin to the GitHub Container Registry (WordPress/gutenberg#75844) (WordPress/gutenberg#76273)
- Connectors: Improve placeholder text and make it translatable (WordPress/gutenberg#75996)
- Block context menu: context menu not closing for disconnecting unsynced pattern menu items (WordPress/gutenberg#75405)
- Connectors: Improve responsive layout for small viewports (WordPress/gutenberg#76231)
- theme.json schema: fix pseudo-class definition for button block (WordPress/gutenberg#76272)
- Navigation block: fix submenu chevron toggle on touch devices (WordPress/gutenberg#76197)

See #64595, #64393.
Built from https://develop.svn.wordpress.org/trunk@61868


git-svn-id: http://core.svn.wordpress.org/trunk@61155 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backported to WP Core Pull request that has been successfully merged into WP Core [Block] Buttons Affects the Buttons Block [Type] Developer Documentation Documentation for developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants