Skip to content

refactor: migrate Button (next) colours to beta tokens - #5222

Draft
pomfrida wants to merge 1 commit into
mainfrom
refactor/button-beta-colour-tokens
Draft

refactor: migrate Button (next) colours to beta tokens#5222
pomfrida wants to merge 1 commit into
mainfrom
refactor/button-beta-colour-tokens

Conversation

@pomfrida

@pomfrida pomfrida commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Part of #5208 (phase 1 of #5119). First component migrated onto the Tokens Studio beta colour tokens — the test case for the migration pattern.

Draft until the alpha-channel disabled tokens (#4741) ship — the disabled states are then swapped here before merge.

The Storybook wiring (beta bundle import + colour-scheme mirroring to <html>) has been extracted to #5224 so component PRs can merge independently. This branch still contains the same wiring changes; once #5224 merges, updating the branch from main reduces this diff to button.css only.

Changes

button.css:

  • All default/hover/pressed/focus colours moved to the beta tokens. Fills and borders use the static step scales (9/10/11 fill, 4/6 subtle hover/pressed, 12 text, 8 border) via a new --_tone-N indirection that data-color-appearance overrides per tone — replacing the legacy dynamic-token mechanism that carried the tone prop
  • Semantic tokens are used where they exist and fit: --eds-text-on-accent, --eds-border-focus
  • Disabled states stay on the legacy tokens with a TODO (🎨 Implement Alpha‑Channel approach for disabled states #4741)

Export gaps and bugs found

Captured as learnings on #5208; fixing them at the source is tracked in #5221:

  • No semantic action/fill group (background-surface-accent-* resolves to steps 14/11/15 — unusable as solid fills)
  • Semantic surface group is accent-only; no accent text/border semantic tokens
  • --eds-border-focus self-reference cycle in the semantic set (concept/semantic name collision; same for --eds-border-disabled)
  • Alpha-channel disabled tokens missing from the export entirely
  • Semantic tokens declared at :root reference scale aliases that only exist under [data-color-scheme] — subtree colour-scheme switching doesn't work for the semantic layer (see chore: load the eds-tokens beta bundle in storybook for the /next migration #5224 for the Storybook workaround)

Verification

  • 71/71 Jest tests pass, snapshot unchanged
  • Visual parity confirmed against prod Storybook for all variants × tones (accent/neutral/danger) × light/dark, including hover and focus-visible states
  • One deliberate deviation: primary label colour is now --eds-text-on-accent (neutral-14, ≈ #E2E2E2) instead of the legacy near-white step 15 — needs design sign-off

@pomfrida pomfrida self-assigned this Jul 22, 2026
pomfrida added a commit that referenced this pull request Jul 28, 2026
…th the widened semantic block

The widened semantic layer and the color-scheme scope rules both apply
to [data-color-scheme] elements at equal specificity, so source order
decides the three duplicate names tracked in #5221. With the previous
alphabetical order the semantic block sorted last and won - and its
--eds-border-focus is a self-reference, computing to the
guaranteed-invalid value, which would have dropped focus outlines for
the incoming Chip (#5225) and Button (#5222) migrations inside scoped
subtrees (both use var(--eds-border-focus) for their focus ring).

The bundler now ranks color-scheme/* after every other layer, so the
scheme-specific values win on scoped elements and every resolved value
matches the pre-widening state. Verified in the browser:
--eds-border-focus resolves to the light/dark blue per subtree, and
text-disabled/border-disabled keep their scheme values.
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.

1 participant