Make WordPress Core

Opened 4 days ago

Last modified 42 hours ago

#66777 new enhancement

Admin reskin: update notice styling to align with latest from WordPress Design System

Reported by: Joen Owned by:
Priority: normal Milestone: Awaiting Review
Component: Administration Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

Followup to https://core.trac.wordpress.org/ticket/64548, and with the same motivation, to ensure the key communication mechanism of notices is consistent across WordPress.

The WordPress Design System has a new design for Notices. It features rounded corners with the same radius as that of widgets, a border all around and thus higher contrast against a grey background. You can see the full array of Notices in ​Storybook, and a screenshot of the "info" notice style is attached.

The proposed scope is the same:

  • Info notices (.notice-info)
  • Success notices (.notice-success)
  • Warning notices (.notice-warning)
  • Error notices (.notice-error)
  • Dismissible notices with dismiss button
  • Inline notices
  • Legacy .updated and .error classes
  • Links and buttons inside notices

The key principles are the same:

  • CSS-Only Changes: No markup or JavaScript modifications
  • Backward Compatibility: All existing selectors preserved, legacy classes styled consistently
  • Semantic Colors: Static colors for each notice type (not tied to admin theme color)
  • Accessibility: Text contrast meets WCAG AA, dismiss button keyboard accessible with visible focus

No new notice classes, no new custom properties, no changes to behaviour our dismissal logic.

That said, one consideration is whether to apply the semantic colour tokens from the WordPress Design System to the notice at the same time, or whether to discuss that sepaerately. These are the same tokens that style the notice inside the editor, semantic tokens for typography, corner radius, spacing, line heights, and colours. Notably the colour tokens afford a future dark mode or high-contrast mode, without any additional markup.

Attachments (1)

info-notice.png​ (37.7 KB ) - added by Joen 4 days ago.
"Info" type notice.

Download all attachments as: .zip

Change History (11)

@Joen
4 days ago

"Info" type notice.

This ticket was mentioned in ​PR #16129 on ​WordPress/wordpress-develop by ​@Joen.


4 days ago
#1

Trac ticket: https://core.trac.wordpress.org/ticket/66777

The above is closed, but with this PR I'm proposing reopening it. If you prefer I create a different trac ticket, happy to, just let me know.

This patch updates the Notices to look like those that appear inside the site editor, and can be seen in ​this story. Here are some screenshots:

https://github.com/user-attachments/assets/ef148644-7805-4c48-a4ee-51f40374cc51

https://github.com/user-attachments/assets/77442828-39b8-45e6-aaeb-34a5f660d93e

I've aspired to keep the CSS changes minimal, as it's a visual change, and I've tested a bunch of the major plugins in it, including Woo which looks as it should:

https://github.com/user-attachments/assets/22be52a1-f919-4fbe-b31f-24104fc11df3

It is worth noting that since this change adds a corner radius—same corner radius used for widgets—some plugins will have rounding:

https://github.com/user-attachments/assets/9370aff2-6373-4c0c-b860-1c896bda90ea

https://github.com/user-attachments/assets/f47c4c50-e6c1-4a32-942e-6bfffabb7b99

There's also a use of the Notice inside the customizer, which as a result gets a 0px radius to avoid this:

https://github.com/user-attachments/assets/28484e84-2e50-46b9-879b-35f7fc5ac996

Why

The motivation is the same as is outlined on the trac ticket: to unify the appearance of the same elements across WordPress. In this case, Notices.

The notice itself uses a full border and toned colour to indicate the type of notice. Not part of this patch, however, the addition of an icon for the type of notice—that's a larger undertaking due to how Notices work in WordPress, but still possibly one to undertake, as colour alone is insufficient to indicate notice type for people of low vision or colour blindness. In that sense, the change is largely stylistic, but the addition of a border all around nevertheless does increase contrast between the notice itself and the background canvas, especially for some colours, e.g. success notices can be hard to see the boundaries of at present:

https://github.com/user-attachments/assets/5ee713d8-237e-46e9-a099-724e1bb868db

Thank you for your time.

Use of AI Tools

Claude Opus 5.

​@Joen commented on ​PR #16129:


4 days ago
#2

Created https://core.trac.wordpress.org/ticket/66777, and edited this issue to point to it. Let me know if that works!

#3 @Joen
4 days ago

  • Summary Admin reskin: update notice stylihng to align with latest from WordPress Design System → Admin reskin: update notice styling to align with latest from WordPress Design System

​@Joen commented on ​PR #16129:


4 days ago
#4

On whether to update to tokens or not, there's an additional question of whether to update instances of Dashicon usage:

https://github.com/user-attachments/assets/2128aa99-eb62-4234-9997-6adcdce22882

Ultimately I think both are worth doing, but whether it's one PR or several, I will honestly defer to you.

​@jameskoster commented on ​PR #16129:


3 days ago
#5

The main question for me is; if we intend to adopt the tokens anyway, is there any reason _not_ to do that now?

My read on the icons is to adopt WordPress/Icons everywhere we currently find Dashicons, but that seems separate.

​@Joen commented on ​PR #16129:


3 days ago
#6

The main question for me is; if we intend to adopt the tokens anyway, is there any reason not to do that now?

From my POV, no. I pose that question on to other reviewers before I update the PR, though.

​@joedolson commented on ​PR #16129:


3 days ago
#7

From an accessibility perspective, I think this is a beneficial change, for the same reason mentioned above - that the notice boundaries are hard to see in some cases. I think it will need to ship pretty early in the cycle, as there are a lot of scenarios where notices appear, and there are probably more than just the customizer that will need additional massaging to account for the addition of borders.

Adding icons is something I'm 100% in favor of; see https://core.trac.wordpress.org/ticket/50442, but it keeps getting stalled out due to the complexity of getting it to work effectively globally and getting design agreement. But with all the design integration work going on, this would potentially be a good time to try and move it forward.

This ticket was mentioned in ​Slack in #core by tessory. ​View the logs.


3 days ago

This ticket was mentioned in ​PR #16198 on ​WordPress/wordpress-develop by ​@Joen.


2 days ago
#11

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-theme where it is needed, and brings the login screen along.

What changed

src/wp-admin/css/common.css

  • the surface, border colour, border width, corner radius and text colour of .notice, div.updated and div.error, and of the four tones, come from var(--wpds-*)
  • the dismiss button takes the notice's tone through color: inherit, gets an outline focus ring instead of a box-shadow one so the ring survives forced-colors mode, and takes its corner radius from the small radius token

src/wp-admin/css/login.css

  • the same paint, from the same tokens, so the login screen's messages look like the admin's
  • .login .message takes the info tone, .login .success the success tone, and notice-error, notice-warning, notice-success and notice-info take theirs, which is the tone the markup already declares

src/wp-includes/script-loader.php

  • the common and login style handles now depend on wp-theme, the stylesheet that defines the tokens

src/wp-admin/css/themes.css and src/wp-admin/css/customize-controls.css

  • two contexts where a notice is a full-bleed band rather than a box of its own now set border-radius: 0. See "Audit" below.

Paint, not geometry

Typography is left for separate work, so font-size and line-height stay as literal values.

Tokens, per stylesheet

wp-theme is declared as a dependency of common and of login rather than of the wp-admin bundle. Those are the stylesheets that hold notice rules, so the tokens load wherever they load, including a plugin page that enqueues common on its own. customize-controls depends on wp-admin, which depends on common, 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-lg is "cards, dialogs, notices, and other larger content containers", which is the notice box. --wpds-border-radius-sm is "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-shadow and outline value is unchanged.

All 65 come from five token values, where the token no longer resolves to the literal:

Role Token Literal Token resolves to Largest channel difference
Neutral surface --wpds-color-background-surface-neutral-weak #f3f3f3 #f4f4f4 1
Success border --wpds-color-stroke-surface-success #91d29c #92d39d 1
Warning border --wpds-color-stroke-surface-warning #e0bc7d #e1bd7c 1
Error border --wpds-color-stroke-surface-error #e1b1a9 #e0afa7 2
Info border --wpds-color-stroke-surface-info #acc5e2 #adc6e2 1

The 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.php renders its messages through wp_admin_notice(), so the markup is already the admin's, but the login screen does not load common.css and 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.css repeats 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.css also 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 cards (.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.
  • the Customizer's notification area, panel and section containers, and per-control notifications, where notices measure the full width of their container with no inset and stack flush with 1px separators. An 8px radius turned the stack into a column of rounded pills.

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_notices in 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

  1. Visit any admin screen with a notice. Site Health shows several.
  2. Check each tone, the legacy div.updated and div.error classes, .notice-alt, .notice-large, .notice-title, .notice.inline, dismissible notices and multi-paragraph notices.
  3. Check the two audited contexts: a theme card with an update available, and the Customizer's notification area.
  4. Confirm the dismiss button still sits where it sits today and is still centred on the first line.
  5. Log out and back in, and check wp-login.php?loggedout=true, a failed login, and the lost-password flow.
  6. Set data-wpds-root-provider="true" and data-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.
  7. Below 782px, in RTL and in forced-colors mode.

​@Joen commented on ​PR #16129:


2 days ago
#12

Thanks Joe, thanks all for the feedback. I pushed a small change to fix a corner radius issue in the customizer and in theme cards, but this should be good to go for any other manual reviews need to happen.

The main open question: tokenize or not?

I think Jay's reasons mentioned for why we should tokenize are solid: they protect against drift, and they are already available in the admin.

What I realised though is that those tokens are available in the admin, but not in the login screen. So out of an abundance of caution and simply because I think this change is worth shipping in 7.3 (early if possible, as Joe suggests) is more important than also tokenising at the same time.

So instead I opened a separate PR, #16198, which does the exact same thing as this PR, but tokenises all the Notice related values (colours, padding, borders), and adds the theme provider (tokens) to the login screen. That adds an additional 9KB, minified, to the login screen.

Both PRs should not ship, one should be closed in favour of the other. So the two exist as alternatives to pick from: tokenise now, or tokenise later. Penny for your thoughts?

Note: See TracTickets for help on using tickets.