Skip to content

fix: SW-2443 per-variant disabled treatment for legible contrast - #209

Open
boramyi-ts wants to merge 2 commits into
mainfrom
SW-2443-button-disabled-contrast
Open

fix: SW-2443 per-variant disabled treatment for legible contrast#209
boramyi-ts wants to merge 2 commits into
mainfrom
SW-2443-button-disabled-contrast

Conversation

@boramyi-ts

@boramyi-ts boramyi-ts commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

SW-2443 — Button disabled state: legible, consistent contrast

Jira: SW-2443

Button applied a blanket disabled:opacity-50 to every variant. On the solid default that's fine, but at half opacity the transparent variants (outline / ghost / link) and the destructive tint stay colored and barely separate from their enabled state — and, measured, the faded label drops below the AA text-contrast threshold on every variant.

Change: drop the blanket opacity fade; give each variant a neutral muted disabled treatment instead:

  • default / secondary / destructivebg-muted + text-muted-foreground
  • outline → muted border + faint bg-muted/40 + text-muted-foreground
  • ghost / linktext-muted-foreground (no fill; link also drops its underline)

Disabled now reads as clearly "off," stays legible, and looks consistent across variants.

Before / After

Before (opacity-50) After (neutral)
Light before after
Dark before dark after dark

Measured text-vs-fill contrast, disabled state:

Variant Before (light) After (light)
default 2.49:1 ❌ 4.83:1 ✅
secondary 3.17:1 ❌ 4.83:1 ✅
destructive 2.38:1 ❌ 4.83:1 ✅
outline 3.29:1 ❌ 5.56:1 ✅
ghost 3.29:1 ❌ 6.07:1 ✅
link 2.44:1 ❌ 6.07:1 ✅

All variants clear AA (≥ 4.5:1) after the change, in both themes.

Tests

New DisabledContrast story + play test asserts, for every variant, that the disabled button no longer relies on opacity (opacity === 1) and that measured text-vs-fill contrast is ≥ 4.5:1 (a regression guard against the opacity fade returning). Full Button play suite passes (7/7) incl. the automatic axe check; typecheck + lint clean. Zephyr id to be generated via zephyr_sync.

Consumer impact

Every disabled Button in the kit changes appearance (fade → neutral). No API change.

🤖 Generated with Claude Code

Replace the blanket disabled:opacity-50 (which failed AA text contrast on
every variant and left the transparent variants indistinguishable from
enabled) with a neutral muted disabled treatment per variant: solids and
outline get a muted fill, outline keeps a muted border, ghost/link use muted
text. Adds a DisabledContrast story asserting opacity is no longer the
mechanism and every variant clears 4.5:1.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@boramyi-ts
boramyi-ts requested review from a team as code owners September 9, 2026 15:21
@vercel

vercel Bot commented Sep 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ts-lib-ui-kit-storybook Ready Ready Preview Sep 9, 2026 3:29pm UTC

Request Review

@unblocked unblocked Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ No issues found

About Unblocked

Unblocked has been set up to automatically review your team's pull requests to identify genuine bugs and issues.

📖 Documentation — Learn more in our docs.

💬 Ask questions — Mention @unblocked to request a review or summary, or ask follow-up questions.

👍 Give feedback — React to comments with 👍 or 👎 to help us improve.

⚙️ Customize — Adjust settings in your preferences.

@github-actions

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 96.94% (🎯 83%)
🟰 ±0%
24688 / 25467
🟢 Statements 96.94% (🎯 83%)
🟰 ±0%
24688 / 25467
🟢 Functions 94.61% (🎯 74%)
🟰 ±0%
1177 / 1244
🟢 Branches 90.69% (🎯 81%)
🟰 ±0%
4961 / 5470
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/components/ui/button.tsx 100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
Generated in workflow #1203 for commit dbb72c3 by the Vitest Coverage Report Action

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