Editor: Add support for select elements to theme.json.

Adds support for the select element in theme.json so that theme builders and extenders can be style select elements consistently.

We are targeting the select HTML element rather than adding a CSS class, as we do for other elements that theme.json supports. This commit adds no extra styling unless a theme opts in to use this and the specificity of any generated CSS with the element is 0.

See original Gutenberg PR: https://github.com/WordPress/gutenberg/pull/70379.

Example usage:

{{{
	"elements": {
		"select": {
			"color": {
				"text": "red",
				"background": "blue"
			}
		}
	}
}}}

Props onemaggie, joen, get_dave, wildworks, ocean90, mikachan, poena, SirLouen, tusharbharti, yashjawale, abcd95.
Fixes #63555. See #63878.
Built from https://develop.svn.wordpress.org/trunk@61031


git-svn-id: http://core.svn.wordpress.org/trunk@60367 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
scruffian
2025-10-21 13:49:31 +00:00
parent 160ccd428e
commit c4e375fc4e
2 changed files with 2 additions and 1 deletions

View File

@@ -629,6 +629,7 @@ class WP_Theme_JSON {
// The block classes are necessary to target older content that won't use the new class names.
'caption' => '.wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption',
'cite' => 'cite',
'select' => 'select',
);
const __EXPERIMENTAL_ELEMENT_CLASS_NAMES = array(

View File

@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.9-alpha-61030';
$wp_version = '6.9-alpha-61031';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.