From d5243f4ddf547bf16a83cbf65155fa1e4f5e2884 Mon Sep 17 00:00:00 2001 From: scruffian Date: Tue, 21 Oct 2025 12:40:31 +0000 Subject: [PATCH] Editor: Add support for text inputs to theme.json. Adds support for text input elements to theme.json so that theme builders and extenders can be style text input elements consistently. Text input elements are `textarea`, and `input` with type `email`, `number`, `password`, `search`, `text`, `tel` and `url`. We are targeting the HTML elements directly 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/70378. Example usage: {{{ "elements": { "textInput": { "border": { "radius": "0", "style": "solid", "width": "1px", "color": "red" }, "color": { "text": "var(--wp--preset--color--theme-2)" }, "typography": { "fontFamily": "var(--wp--preset--font-family--inter)" } } } }}} Reviewed by mukesh27, scruffian. Merges [9600] to the 6.9 branch. Props onemaggie, mukesh27, sabernhardt, joen, get_dave, wildworks, ocean90, mikachan, poena. Fixes #63878. See #63555. Built from https://develop.svn.wordpress.org/trunk@61023 git-svn-id: http://core.svn.wordpress.org/trunk@60359 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-theme-json.php | 24 +++++++++++++----------- wp-includes/version.php | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/wp-includes/class-wp-theme-json.php b/wp-includes/class-wp-theme-json.php index 2be6a2a939..c980466a16 100644 --- a/wp-includes/class-wp-theme-json.php +++ b/wp-includes/class-wp-theme-json.php @@ -613,22 +613,24 @@ class WP_Theme_JSON { * * @since 5.8.0 * @since 6.1.0 Added `heading`, `button`, and `caption` elements. + * @since 6.9.0 Added `textInput` elements. * @var string[] */ const ELEMENTS = array( - 'link' => 'a:where(:not(.wp-element-button))', // The `where` is needed to lower the specificity. - 'heading' => 'h1, h2, h3, h4, h5, h6', - 'h1' => 'h1', - 'h2' => 'h2', - 'h3' => 'h3', - 'h4' => 'h4', - 'h5' => 'h5', - 'h6' => 'h6', + 'link' => 'a:where(:not(.wp-element-button))', // The `where` is needed to lower the specificity. + 'heading' => 'h1, h2, h3, h4, h5, h6', + 'h1' => 'h1', + 'h2' => 'h2', + 'h3' => 'h3', + 'h4' => 'h4', + 'h5' => 'h5', + 'h6' => 'h6', // We have the .wp-block-button__link class so that this will target older buttons that have been serialized. - 'button' => '.wp-element-button, .wp-block-button__link', + 'button' => '.wp-element-button, .wp-block-button__link', // 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', + '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', + 'textInput' => 'textarea, input:where([type=email],[type=number],[type=password],[type=search],[type=text],[type=tel],[type=url])', ); const __EXPERIMENTAL_ELEMENT_CLASS_NAMES = array( diff --git a/wp-includes/version.php b/wp-includes/version.php index 19973323c2..58bdb20a6f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.9-alpha-61022'; +$wp_version = '6.9-alpha-61023'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.