Skip to content

Theme: Add disabled variants for brand and error interactive color tokens#79124

Merged
ciampo merged 6 commits into
trunkfrom
add/theme-interactive-brand-error-disabled-tokens
Jun 15, 2026
Merged

Theme: Add disabled variants for brand and error interactive color tokens#79124
ciampo merged 6 commits into
trunkfrom
add/theme-interactive-brand-error-disabled-tokens

Conversation

@ciampo

@ciampo ciampo commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

What?

Addresses point T-M5 of #77462.

Adds disabled variants for the brand and error tones across the interactive color tokens (background, foreground, stroke), for parity with the existing neutral disabled tokens, and adopts them in the Button, AlertDialog, and Select/Autocomplete/Combobox components.

New tokens

background.interactive

  • --wpds-color-background-interactive-brand-strong-disabled
  • --wpds-color-background-interactive-brand-weak-disabled
  • --wpds-color-background-interactive-error-disabled
  • --wpds-color-background-interactive-error-strong-disabled
  • --wpds-color-background-interactive-error-weak-disabled

foreground.interactive

  • --wpds-color-foreground-interactive-brand-disabled
  • --wpds-color-foreground-interactive-brand-strong-disabled
  • --wpds-color-foreground-interactive-error-disabled
  • --wpds-color-foreground-interactive-error-strong-disabled

stroke.interactive

  • --wpds-color-stroke-interactive-brand-disabled
  • --wpds-color-stroke-interactive-error-disabled

Why?

disabled variants existed only for the neutral tone, so a disabled brand/error element had to borrow the neutral token. These parity tokens let each tone reference its own disabled state. The values match the corresponding neutral disabled values, so there is no visual change. The stroke set mirrors neutral, which exposes only a normal-emphasis disabled stroke (no strong-emphasis variant).

How?

  • Added the token definitions in `packages/theme/tokens/color.json` and made the disabled token descriptions tone-specific.
  • Regenerated the prebuilt artifacts via `npm run build` (CSS, JS allow-list/fallbacks, TS types, `docs/tokens.md`).
  • Adopted the new tokens in `@wordpress/ui` (`Button`, `AlertDialog`, and disabled `Select`/`Autocomplete`/`Combobox` list items).

Testing Instructions

  • `npm run build` in `packages/theme` produces no diff against the committed prebuilt files.
  • Disabled `brand`/`error` buttons and the `AlertDialog` destructive action render identically to before (no visual change).

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

Size Change: +151 B (0%)

Total Size: 8.58 MB

📦 View Changed
Filename Size Change
build/modules/boot/index.min.js 52.8 kB +34 B (+0.06%)
build/modules/content-types/index.min.js 159 kB +14 B (+0.01%)
build/scripts/editor/index.min.js 473 kB +16 B (0%)
build/scripts/theme/index.min.js 22.3 kB +87 B (+0.39%)

compressed-size-action

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

Flaky tests detected in 8ee8bfc.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/27578962689
📝 Reported issues:

@ciampo ciampo force-pushed the add/theme-interactive-brand-error-disabled-tokens branch from 5aea0e7 to e71b55f Compare June 12, 2026 15:22
@github-actions github-actions Bot added the [Package] UI /packages/ui label Jun 12, 2026
@ciampo ciampo self-assigned this Jun 12, 2026
@ciampo ciampo added the [Type] Enhancement A suggestion for improvement. label Jun 12, 2026
@ciampo ciampo marked this pull request as ready for review June 12, 2026 17:55
@ciampo ciampo requested a review from a team as a code owner June 12, 2026 17:55
@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown

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.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: aduth <aduth@git.wordpress.org>

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

@ciampo ciampo force-pushed the add/theme-interactive-brand-error-disabled-tokens branch from b7d8f6c to 87225b1 Compare June 15, 2026 15:33

@aduth aduth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM 👍 Importantly I think this detaches semantics from styling in a way that's true to how we structure tokens and avoids tying ourselves incidentally to "gray" as disabled in case we want to change course on that styling in the future.

Comment thread packages/theme/tokens/color.json Outdated
@aduth

aduth commented Jun 15, 2026

Copy link
Copy Markdown
Member

This tokens naming consistency work had me thinking again about the AI agent confusion I mentioned in #78438 (comment). Is there a similar case to be made about adding a "duplicate" var(--wpds-color-foreground-content-brand); for completeness' sake?

ciampo added 4 commits June 15, 2026 23:53
…kens

Add `disabled` variants for the `brand` and `error` tones across the
interactive `bg`, `fg`, and `stroke` color tokens, mirroring the existing
tone-agnostic `neutral` disabled tokens. This brings brand/error to parity
with neutral (T-M5).
…in consumers

Now that brand/error tones have their own disabled tokens, reword the
disabled `$description`s to be tone-specific (dropping "regardless of the
tone" from the neutral ones, which was the shared-disabled rationale).

Update the `Button` (brand) and `AlertDialog` (error) disabled states to
reference the matching tone-specific disabled tokens instead of reaching
into the `neutral` namespace. Values are identical, so there is no visual
change.

`item-popup` is left on `neutral-disabled`: its disabled color applies to
the item text, which is neutral-toned in every state (only the highlight
background is brand-toned, and disabled items are never highlighted).
The disabled item background is brand-toned (the highlight uses
`brand-weak-active`). Reference `background-interactive-brand-weak-disabled`
explicitly so the disabled state stays in sync if the token value ever
changes, even though it currently resolves to transparent. The item text
remains neutral-toned.
The neutral stroke tone exposes only a normal-emphasis disabled token (no strong-emphasis disabled variant), so the error tone should match. Removes the unused strong-emphasis disabled stroke token and regenerates the prebuilt artifacts and docs.
@ciampo

ciampo commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

This tokens naming consistency work had me thinking again about the AI agent confusion I mentioned in #78438 (comment). Is there a similar case to be made about adding a "duplicate" var(--wpds-color-foreground-content-brand); for completeness' sake?

content tokens are for non-interactive UI, and as such, we don't expose disabled tokens for that.

ciampo added 2 commits June 15, 2026 23:54
The disabled list-item background in Select/Autocomplete/Combobox is a newly added declaration, not a swap of an existing neutral token.
Several interactive background tokens (the weak/normal and disabled variants for the neutral, brand, and error tones) repeated the same inline fully-transparent value. Extract it into a shared `primitive.transparent` token and reference it, mirroring how the other disabled tokens already alias primitives. Internal-only: primitives are not emitted as custom properties, so there is no public API or resolved-value change.
@ciampo ciampo force-pushed the add/theme-interactive-brand-error-disabled-tokens branch from 1f850ec to 8ee8bfc Compare June 15, 2026 21:55
@ciampo ciampo enabled auto-merge (squash) June 15, 2026 21:57
@ciampo ciampo merged commit cd7b4af into trunk Jun 15, 2026
43 checks passed
@ciampo ciampo deleted the add/theme-interactive-brand-error-disabled-tokens branch June 15, 2026 22:27
@github-actions github-actions Bot added this to the Gutenberg 23.5 milestone Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Theme /packages/theme [Package] UI /packages/ui [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants