Repository navigation
Conversation
Notices get a surface, a full hairline border, a corner radius and a text colour, in place of a white box with a 4px coloured bar on one side. The paint comes from `--wpds-*` tokens, so a notice follows the theme the tokens resolve to rather than freezing one revision of the colour algorithm. Adds `wp-theme` as a dependency of the `common` and `login` style handles. The dependency is declared per stylesheet rather than on the `wp-admin` bundle, so the tokens also load on screens that enqueue those stylesheets on their own. The login screen renders its messages through `wp_admin_notice()`, so its markup is already the admin's, but it does not load `common.css`. Its notice paint is repeated in `login.css` from the same tokens, and its messages now take the tone their markup declares. Sets `border-radius: 0` on notices in theme cards and in the Customizer's notification containers, where a notice is a band pinned to its container's edges rather than a box of its own. The dismiss button's corner radius comes from the small radius token, so it follows the theme along with the notice it sits in. Padding, margins, font size and line height are unchanged, as are the dismiss button's position and size. See #66777. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Test using WordPress PlaygroundThe 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
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Trac ticket: https://core.trac.wordpress.org/ticket/66777
Notices get a surface, a full hairline border, a corner radius and a text colour, in place of today's white box with a 4px coloured bar on one side. The paint comes from
--wpds-*design system tokens, so a notice follows whatever theme the tokens resolve to.Alternative to #16129 which tokenises all values based on the feedback shared there. That PR makes the same visual change with literal values and no new dependency; this one makes it with tokens, adds
wp-themewhere it is needed, and brings the login screen along.What changed
src/wp-admin/css/common.css.notice,div.updatedanddiv.error, and of the four tones, come fromvar(--wpds-*)color: inherit, gets an outline focus ring instead of abox-shadowone so the ring survives forced-colors mode, and takes its corner radius from the small radius tokensrc/wp-admin/css/login.css.login .messagetakes the info tone,.login .successthe success tone, andnotice-error,notice-warning,notice-successandnotice-infotake theirs, which is the tone the markup already declaressrc/wp-includes/script-loader.phpcommonandloginstyle handles now depend onwp-theme, the stylesheet that defines the tokenssrc/wp-admin/css/themes.cssandsrc/wp-admin/css/customize-controls.cssborder-radius: 0. See "Audit" below.Paint, not geometry
Typography is left for separate work, so
font-sizeandline-heightstay as literal values.Tokens, per stylesheet
wp-themeis declared as a dependency ofcommonand ofloginrather than of thewp-adminbundle. Those are the stylesheets that hold notice rules, so the tokens load wherever they load, including a plugin page that enqueuescommonon its own.customize-controlsdepends onwp-admin, which depends oncommon, so the Customizer picks the tokens up through that chain.Which radius token
The design system documents the radius scale by the kind of element each step is for.
--wpds-border-radius-lgis "cards, dialogs, notices, and other larger content containers", which is the notice box.--wpds-border-radius-smis "standalone buttons, inputs, and compact controls", which is the dismiss button. Both resolve to the values used today, 8px and 2px.Nothing moved
Computed styles were compared against the literal-value version of this change across 18 notice variants and four probes each: the box, its paragraph, the dismiss button and the notice title. Of 1102 properties compared, 1037 are identical and 65 differ. None of the differences is geometry: every radius, border width, padding, margin,
font-size,line-height,box-shadowand outline value is unchanged.All 65 come from five token values, where the token no longer resolves to the literal:
--wpds-color-background-surface-neutral-weak#f3f3f3#f4f4f4--wpds-color-stroke-surface-success#91d29c#92d39d--wpds-color-stroke-surface-warning#e0bc7d#e1bd7c--wpds-color-stroke-surface-error#e1b1a9#e0afa7--wpds-color-stroke-surface-info#acc5e2#adc6e2The other twelve values match their tokens exactly.
Contrast is unchanged for the four tones and marginally better for neutral, because only the surface moved and the text colours did not: neutral goes from 15.02:1 to 15.16:1; success stays at 15.23:1, warning at 15.65:1, error at 15.58:1 and info at 15.60:1. The login screen's five tones measure identically to the admin's.
The login screen
wp-login.phprenders its messages throughwp_admin_notice(), so the markup is already the admin's, but the login screen does not loadcommon.cssand so kept the old look. Leaving it out would have made it the one screen where a notice does not follow the design system, which is the opposite of the point, so it is in:login.cssrepeats the notice paint from the same tokens.Its messages take the tone their markup declares. An instructional message is rendered as
notice notice-info, so it is now info-toned instead of carrying a brand-blue bar, and an error is error-toned.login.cssalso carried a comment reading "Match border color from common.css", which is gone along with the literals it described.Audit
Notices were checked in the places they appear, since a full border has more neighbours than a bar on one side does. Two contexts needed a fix, both because a notice there is a band pinned to a container's edges rather than a box of its own, and both fixed with
border-radius: 0:.theme .notice), where the notice is absolutely positioned across the top of a card that clips at its own 8px radius. The card clips at a 7px inner curve while the band curved at 8px, which left the card's background showing in a sliver at each top corner, and rounded the band's bottom corners in mid-card.Everywhere else the notice is already inset by a margin and reads correctly as a box: Site Health, Privacy, Settings, Profile, the Dashboard, the Media Library and the image editor in the media modal, plugin update and auto-update rows, Add Plugins cards including dependency notices, Nav Menus, Quick Edit and the filesystem credentials form. The block editor and the block-based widgets screen do not render
admin_noticesin their chrome.Nothing in the audit needed a geometry change. Two gaps worth naming: the network admin was not rendered, because the test install is single-site, though no admin stylesheet contains a network-specific notice rule; and the media modal was reviewed from its CSS rather than rendered, because the install had no attachments.
Icons
Not in this patch yet, but worth doing. Let me know your preference, happy to open a separate patch, or include it here or in #16129.
Testing
div.updatedanddiv.errorclasses,.notice-alt,.notice-large,.notice-title,.notice.inline, dismissible notices and multi-paragraph notices.wp-login.php?loggedout=true, a failed login, and the lost-password flow.data-wpds-root-provider="true"anddata-wpds-corner-radius="none"on the root element: notices and their dismiss buttons should square off in the admin and on the login screen, and nothing else should move.