From b58c298eabd3fcef6e0d79267eaaf0bbf850e6bf Mon Sep 17 00:00:00 2001 From: Omar Alshaker Date: Mon, 13 Jul 2026 19:25:41 +0200 Subject: [PATCH] Notice: Fix low-contrast action controls on dark theme backgrounds The legacy `--wp-admin-theme-color` accent is a fixed value that does not adapt to the theme background. On the tinted, dark surfaces used in a dark theme, the Notice's link/secondary/tertiary action controls therefore fall below the minimum contrast ratio (~2.2:1). Redirect the accent to the theme-aware `--wpds-color-foreground-interactive-brand` token for those variants, matching the outline/minimal treatment in the `@wordpress/ui` Button. Primary actions keep the accent as their fill, so they are intentionally excluded. Co-Authored-By: Claude Opus 4.8 --- packages/components/CHANGELOG.md | 1 + packages/components/src/notice/style.scss | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 2d4c8b030dc54a..4effa5d3dab5a5 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -50,6 +50,7 @@ ### Bug Fixes +- `Notice`: Fix low-contrast link/secondary action controls on dark theme backgrounds by pointing their accent color at the theme-aware `--wpds-color-foreground-interactive-brand` token. - `SandBox`: Inject the resize script into the document `` so an unclosed attribute quote in the sandboxed HTML can no longer swallow the script and leak its source as visible text in the preview. ([#79920](https://github.com/WordPress/gutenberg/pull/79920)) - `Divider`: Restore lower-specificity border styles so custom border colors can override the default divider color. ([#79534](https://github.com/WordPress/gutenberg/pull/79534)) - `Button`: Fix the focus ring for buttons rendered as links ([#79837](https://github.com/WordPress/gutenberg/pull/79837)). diff --git a/packages/components/src/notice/style.scss b/packages/components/src/notice/style.scss index a5bea1676abb1b..dde324a73f18fe 100644 --- a/packages/components/src/notice/style.scss +++ b/packages/components/src/notice/style.scss @@ -60,6 +60,19 @@ margin-top: var(--wpds-dimension-gap-sm); } +// The legacy `--wp-admin-theme-color` accent is a fixed value that does not +// adapt to the theme background. On the tinted, dark surfaces used in a dark +// theme, link/secondary/tertiary actions therefore fall below the minimum +// contrast ratio. Redirect the accent to the theme-aware brand foreground +// token for those variants — matching the outline/minimal treatment in the +// `@wordpress/ui` Button. Primary actions keep the accent as their fill, so +// they are intentionally excluded. +.components-notice__action:not(.is-primary) { + --wp-components-color-accent: var(--wpds-color-foreground-interactive-brand); + --wp-components-color-accent-darker-10: var(--wpds-color-foreground-interactive-brand-active); + --wp-components-color-accent-darker-20: var(--wpds-color-foreground-interactive-brand-active); +} + .components-notice__dismiss { grid-column: 2; grid-row: 1;