Make WordPress Core

Changeset 61031


Ignore:
Timestamp:
10/21/2025 01:47:20 PM (3 months ago)
Author:
scruffian
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-theme-json.php

    r61024 r61031  
    630630        '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',
    631631        'cite'    => 'cite',
     632        'select'  => 'select',
    632633    );
    633634
Note: See TracChangeset for help on using the changeset viewer.