From 8a37398eeca0fa61c01322722a25a1464ec53d94 Mon Sep 17 00:00:00 2001 From: Sukhendu Sekhar Guria Date: Tue, 5 May 2026 12:11:45 +0530 Subject: [PATCH 1/2] Remove hardcoded button colors from core theme.json --- src/wp-includes/theme.json | 4 --- .../tests/theme/wpThemeJsonResolver.php | 28 +++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/theme.json b/src/wp-includes/theme.json index fb26d36518841..15ae6d9434717 100644 --- a/src/wp-includes/theme.json +++ b/src/wp-includes/theme.json @@ -380,10 +380,6 @@ }, "elements": { "button": { - "color": { - "text": "#fff", - "background": "#32373c" - }, "spacing": { "padding": { "top": "calc(0.667em + 2px)", diff --git a/tests/phpunit/tests/theme/wpThemeJsonResolver.php b/tests/phpunit/tests/theme/wpThemeJsonResolver.php index ce5609a396f18..58ecce9caeb94 100644 --- a/tests/phpunit/tests/theme/wpThemeJsonResolver.php +++ b/tests/phpunit/tests/theme/wpThemeJsonResolver.php @@ -1484,4 +1484,32 @@ public function test_block_style_variation_merge_order() { $this->assertSameSetsWithIndex( $expected, $actual, 'Merged variation styles do not match.' ); } + + /** + * Tests that core theme.json does not emit hardcoded button color declarations + * that would override theme styles due to CSS load order. + * + * @covers WP_Theme_JSON_Resolver::get_core_data + * @ticket 65162 + */ + public function test_core_theme_json_does_not_set_button_colors() { + $stylesheet = WP_Theme_JSON_Resolver::get_core_data()->get_stylesheet( array( 'styles' ) ); + + preg_match( '/:root :where\(\.wp-element-button[^{]*\)\s*\{[^}]*\}/', $stylesheet, $matches ); + $this->assertNotEmpty( $matches, 'Button element rule should exist in core stylesheet.' ); + + $button_rule = $matches[0]; + + $this->assertStringNotContainsString( + 'background-color', + $button_rule, + 'Core theme.json must not set a background-color on the button element.' + ); + + $this->assertStringNotContainsString( + 'color:', + $button_rule, + 'Core theme.json must not set any color property on the button element.' + ); + } } From 82faafc59b8e968cc7ac588fe24ce0545338f041 Mon Sep 17 00:00:00 2001 From: "wordpress-develop-pr-bot[bot]" <1178653+wordpress-develop-pr-bot[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 06:46:05 +0000 Subject: [PATCH 2/2] Automation: Updating built files with changes. --- src/wp-includes/theme.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wp-includes/theme.json b/src/wp-includes/theme.json index 15ae6d9434717..fb26d36518841 100644 --- a/src/wp-includes/theme.json +++ b/src/wp-includes/theme.json @@ -380,6 +380,10 @@ }, "elements": { "button": { + "color": { + "text": "#fff", + "background": "#32373c" + }, "spacing": { "padding": { "top": "calc(0.667em + 2px)",