Skip to content

Include base styles for additional admin screens#10948

Open
peterwilsoncc wants to merge 4 commits intoWordPress:trunkfrom
peterwilsoncc:fix/64640-alt-use-base-styles
Open

Include base styles for additional admin screens#10948
peterwilsoncc wants to merge 4 commits intoWordPress:trunkfrom
peterwilsoncc:fix/64640-alt-use-base-styles

Conversation

@peterwilsoncc
Copy link
Contributor

@peterwilsoncc peterwilsoncc commented Feb 16, 2026

Alternative approach to #10934

This adds the base styles as dependencies to the login and install stylesheets.

For non-admin admin screens:

  • the default theme's body class is added for screens that do not require a login
  • the user's selected theme's body class is added for screens that do require a login

When determining additional locations that required the theme's body class, I did a search for the string wp-core-ui.

Trac ticket: https://core.trac.wordpress.org/ticket/64640
Trac ticket: https://core.trac.wordpress.org/ticket/64548

Review requests:

  • Ensure that I've used get_user_option() for all logged in screens
  • Ensure that I've not used get_user_option() where it is unavailable (if that's a thing)
  • Double check my work by searching the code base for wp-core-ui for instances I've missed, added unnecessarily.
  • Let me know if this will leak styles to the front end.

Test the DB repair screen

  1. In your wp-config file, add the line define( 'WP_ALLOW_REPAIR', true );
  2. Visit /wp-admin/maint/repair.php
  3. Ensure buttons display as expected

Test the DB upgrade screen

  1. In version.php bump the DB version to a higher number
  2. Visit /wp-admin
  3. Ensure the buttons display on the upgrade screen
  4. Unbump the DB version
  5. Reload the upgrade screen
  6. Ensure the secondary button is displayed correctly

Test the login screen

  1. Log out
  2. Ensure the login button displays
  3. Check and uncheck the remember me checkbox
  4. Ensure the state is visible
  5. Go through the password reset flow
  6. Ensure the buttons display as expected on each step

I think that's it.

Benefits of this approach

This is a very subjective view, reviewers please let me know if you disagree!

I think this is less of a maintenance burden than using css variable fallbacks. While the fallbacks will work, every time a CSS variable in the base styles is tweaked in the default theme, the developer will lead to remember to modify the occurrences in the CSS variable fallbacks.

By applying the base styles to the non-logged in screens, devs can be sure tweaking the default styles will update in all the locations.

Use of AI Tools

Nill for coding, initial code review.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@github-actions
Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to ensure core “base styles” are present on additional non-admin admin screens (notably login and install/upgrade/repair flows) so UI components like buttons render consistently outside the main admin.

Changes:

  • Adds wp-base-styles as a dependency for the login and install stylesheets.
  • Adds an admin-color-* body class to several non-admin admin screens that output wp-core-ui.
  • Removes a now-redundant login input background rule, relying on the base styles instead.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/wp-login.php Adds admin-color-modern to login body classes.
src/wp-includes/script-loader.php Makes login/install styles depend on wp-base-styles.
src/wp-admin/upgrade.php Adds admin-color-modern to the upgrade screen body class.
src/wp-admin/setup-config.php Adds admin-color-modern to setup-config body classes.
src/wp-admin/maint/repair.php Adds admin-color-modern to the DB repair screen body class.
src/wp-admin/install.php Adds admin-color-modern to installer body classes.
src/wp-admin/includes/template.php Adds user-derived admin-color-* class to Thickbox iframe body class construction.
src/wp-admin/includes/media.php Adds user-derived admin-color-* class to legacy media upload iframe body class.
src/wp-admin/css/login.css Removes explicit white background styling for certain login inputs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@peterwilsoncc peterwilsoncc marked this pull request as ready for review February 16, 2026 23:52
@github-actions
Copy link

github-actions bot commented Feb 16, 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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props peterwilsoncc, westonruter, fabiankaegy, audrasjb.

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

@fabiankaegy
Copy link
Member

Thank you for this! :)

I originally started with loading the base styles but then failed at the step of adding the default themes admin scheme class to the screens and was concerned that there might be additional screens I wasn't aware of. Which is why I then went with the other approach. But I agree it isn't ideal. So this here feels better to me 👍

@audrasjb
Copy link
Contributor

audrasjb commented Feb 17, 2026

By applying the base styles to the non-logged in screens, devs can be sure tweaking the default styles will update in all the locations.

I wasn't fond of loading all these resources on such a screen, but this is the main reason why I do think this would be the best approach to fix this issue.

@peterwilsoncc peterwilsoncc force-pushed the fix/64640-alt-use-base-styles branch from 4419839 to 9aac6d6 Compare February 17, 2026 20:56
@westonruter
Copy link
Member

westonruter commented Feb 17, 2026

The notices shown on wp-login.php seems like they aren't styled with the right color yet:

Login screen Password Reset
image image

The upgrade screen looks right, but as with the login screen, the WP logo seems it will need to have its hue shifted to match.

image

@peterwilsoncc
Copy link
Contributor Author

@westonruter Noices were updated in another ticket, I've reopened to investigate in a separate PR, see Core-64548 (comment)

@peterwilsoncc
Copy link
Contributor Author

peterwilsoncc commented Feb 17, 2026

ada4dae fixes the notices on the login screen @westonruter highlights above, cc @joedolson @fabiankaegy

I was going to try and fix the login notices in another PR but realised I needed the base styles.

Rego screen Rego success lost pw lost pw success lpw error
register-for-site register-success lost-your-password lost-password-error password-error

@@ -15,7 +15,7 @@ body {
}

a {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These will need validation that there aren't any side-effects. The color of the back to site and lost password links in the footer of the screen are coded with a higher specificity so I think they will be fine.

@westonruter
Copy link
Member

westonruter commented Feb 18, 2026

ada4dae fixes the notices on the login screen

That still doesn't look quite right, as there is no background color for the notice? Maybe that's how it is supposed to be, but it feels off given how I'm used to seeing the notices.

Although there is a background color for the error notice. Shouldn't there be something for the info notice?

@peterwilsoncc
Copy link
Contributor Author

There was no background with the test notices I threw in the dashboard so I think it's intended.

Screenshot 2026-02-18 at 12 48 33 pm

@westonruter
Copy link
Member

I selected the Sunrise color scheme and I see these screens:

Repair DB Upgrade Login wp_iframe()
image image image image

Only in the wp_iframe() is the color scheme shown, which I believe is as expected. It shows the expected scheme when I switch back to the default:

image
Plugin Code to test wp_iframe()

Navigating to /wp-admin/admin-ajax.php?action=my_iframe_content:

<?php

add_action( 'wp_ajax_my_iframe_content', function () {
	wp_iframe('my_iframe_content');
	exit;
} );


function my_iframe_content() {
	echo '<div style="margin:20px;">';
	echo '<h1>Hello from inside the iframe!</h1>';
	echo '<button class="button button-primary">test</button>';
	echo '</div>';
}

Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

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

LGTM, bit I defer to others who are more familiar with styling the admin.

@westonruter
Copy link
Member

Here's a diff of the HTML for the login page before and after this change:

--- before.html	2026-02-17 18:09:58
+++ after.html	2026-02-17 18:10:24
@@ -12,11 +12,12 @@
 <link rel='stylesheet' id='buttons-css' href='http://localhost:8000/wp-includes/css/buttons.css?ver=7.0-alpha-61215-src' media='all' />
 <link rel='stylesheet' id='forms-css' href='http://localhost:8000/wp-admin/css/forms.css?ver=7.0-alpha-61215-src' media='all' />
 <link rel='stylesheet' id='l10n-css' href='http://localhost:8000/wp-admin/css/l10n.css?ver=7.0-alpha-61215-src' media='all' />
+<link rel='stylesheet' id='wp-base-styles-css' href='http://localhost:8000/wp-includes/css/dist/base-styles/admin-schemes.css?ver=7.0-alpha-61215-src' media='all' />
 <link rel='stylesheet' id='login-css' href='http://localhost:8000/wp-admin/css/login.css?ver=7.0-alpha-61215-src' media='all' />
 	<meta name='referrer' content='strict-origin-when-cross-origin' />
 		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
 		</head>
-	<body class="login no-js login-action-login wp-core-ui  locale-en-us">
+	<body class="login no-js login-action-login wp-core-ui admin-color-modern  locale-en-us">
 	<script>
 document.body.className = document.body.className.replace('no-js','js');
 </script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants