Repository navigation
Description
Overview
packages/desktop-app/src/lib/components/ui/button/types.ts:12-14 still uses the alpha-hover idiom that DESIGN.md now forbids, and every variant loses contrast on hover — the opposite of the rule adopted in #2673:
default: 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90'
destructive: 'bg-destructive shadow-xs hover:bg-destructive/90 dark:bg-destructive/60 text-white'
Measured (WCAG relative luminance, alpha composited against --background):
| Variant | Theme | Rest | Hover | |
|---|---|---|---|---|
destructive |
dark | 5.97:1 | 3.39:1 | below AA |
destructive |
light | 5.36:1 | 4.76:1 | degrades |
default |
light | 3.51:1 | 3.05:1 | below AA |
default |
dark | 4.47:1 | 3.81:1 | below AA |
The dark destructive case is the sharp one: hovering "Remove database" makes the label less readable at the exact moment of a destructive commitment.
Why this is not just a token swap
hover:bg-primary-hover / hover:bg-destructive-hover is the obvious fix, but the destructive variant has two coupled problems that need a decision first:
dark:bg-destructive/60makes the dark REST state translucent. Changing only the hover leaves a translucent rest state under an opaque hover, which is incoherent. Is the muted /60 dark treatment deliberate, or stock shadcn carried over?text-whitebypasses--destructive-foreground. Success token is below WCAG AA as text on light surfaces; *-foreground tokens are white in both themes #2668 gave that token real per-theme values precisely because white fails on dark-mode fills (2.00-2.86:1). This variant hardcodes the value that issue removed.
tailwind.config.js also needs --primary-hover / --destructive-hover registered under theme.extend.colors before the classes resolve.
Context
This file has not been touched since the repository-flattening commit — it is stock shadcn boilerplate that predates NodeSpace's token work and was never reconciled with the design system. That is why it is filed separately rather than folded into #2673, which added the tokens and migrated the four hand-written call sites.
Blast radius: Button is imported by ~18 files; variant="destructive" is used at settings/sections/database-settings.svelte:226.
Acceptance Criteria
-
--primary-hover/--destructive-hoverregistered intailwind.config.js -
defaultanddestructivevariants use the hover tokens; zero/90alpha hovers remain inbuttonVariants - A decision recorded on
dark:bg-destructive/60: keep the muted dark treatment (and give it a token) or drop it for the solid fill -
destructiveuses--destructive-foregroundrather thantext-white - Every variant's hover contrast is >= AA and >= its rest-state contrast, both themes
- Spot-check the ~18 consumers for visual regressions
Related
- Add --destructive-hover / --primary-hover tokens and unify filled-button hover states #2673 / Add --primary-hover / --destructive-hover and unify filled-button hovers (closes #2673) #2685 — added the tokens and the DESIGN.md rule this violates; found during that review
- Success token is below WCAG AA as text on light surfaces; *-foreground tokens are white in both themes #2668 — gave
--*-foregroundreal per-theme values thattext-whitebypasses
Activity
Address review: guard the hover rule with an executable test
Add --primary-hover / --destructive-hover and unify filled-button hov…
malibio commentedon Sep 17, 2026
Baseline on a fresh worktree — Frontend: 249 test files / 5134 tests passed.
malibio commentedon Sep 17, 2026
Implementation notes
All eight contrast figures in the issue reproduce exactly. After the fix:
defaultdefaultdestructivedestructiveDecision on
dark:bg-destructive/60— droppedThe issue asked whether the muted dark treatment was deliberate. It resolves as a symptom of
text-white, not a design choice, and the two had to be decided together:--destructivefill,text-whiteis 2.86:1./60lightened that fill toward the page, which is the only thing that made white survive there at all.So removing
/60while keepingtext-whitewould have made it worse, and keeping/60under an opaque hover would have been incoherent. Both go: the variant is solid in both themes and labels with--destructive-foreground, taking dark rest from 2.86:1 to 6.95:1.Light mode is visually unchanged — light
--destructive-foregroundis0 0% 100%, identical to thetext-whiteit replaces. Only dark mode moves, which is where the defect was.Tailwind registration
Registered without an
<alpha-value>placeholder, deliberately, sohover:bg-destructive-hover/90does not resolve — a hover fill is opaque by definition, and an alpha channel would reopen the idiom this removes. Only--primary-hoverand--destructive-hoverare registered;--success/--warninghave no Tailwind color entry at all today and no utility usage, so registering only their hovers would have been incoherent.Test
The existing
filled-button-hover.test.tspassed throughout the entire period this bug was live — it proves the token values obey the rule, which is necessary but not sufficient. The gap between correct tokens and a component that ignores them is exactly how this shipped, sofilled-button-variants.test.ts(14 tests) asserts consumption instead.Verified by mutation rather than assumed:
<alpha-value>re-added to the config entry--destructive-hover76% → 64% — wrong direction, still 7.3:1The third is the case an AA floor alone would miss, and is why the load-bearing assertion compares hover contrast to rest contrast rather than to a constant.
Also compiled the real emitted class strings through PostCSS to confirm they resolve to opaque
hsl(var(--*-hover))rules and that zero alpha hover rules remain — a class-name assertion alone cannot prove the build emits anything.Deliberately not addressed
A rest-state AA floor.
--primaryis 3.51:1 light / 4.47:1 dark against its own foreground at rest — both under AA, both pre-existing properties of the brand color, and unreachable by any hover change. My first draft asserted a rest floor and failed on exactly this; asserting it would make the suite fail on a defect it does not own. Worth its own issue if the brand color is up for revision.Filed separately
Badgecarries the identical three defects from the same stock shadcn origin. Currently unreachable: every badge hover is gated behind[a&]:and no badge in the codebase is a link or uses thedefault/destructivevariants. Latent rather than live, which is why it is not folded in here.DESIGN.mdstates "No outline/ghost variants in the current system" whileghost/outlineare used 57 times. Needs a design decision, not a transcription.Verification
bun run test— 250 files / 5148 tests passed (baseline 249 / 5134)bun run quality:fix— clean; design-token baseline unchanged at 137; svelte-check 2540 files, 0 errors, 0 warningsbuttonVariantsusers are the calendar prev/next buttons on the untouchedoutlinevariantapp.cssuntouched — scope is the component and its Tailwind registrationMake the shared Button consume the hover tokens (closes #2689)