Repository navigation
Description
Overview
packages/desktop-app/src/lib/components/ui/badge/types.ts:10-14 carries the same three defects that #2689 fixed in the sibling Button, from the same stock shadcn origin:
default: 'bg-primary text-primary-foreground [a&]:hover:bg-primary/90 border-transparent'
secondary: 'bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90 border-transparent'
destructive: 'bg-destructive [a&]:hover:bg-destructive/90 dark:bg-destructive/70 border-transparent text-white'
- Alpha hovers (
/90) instead of the--*-hovertokens — the idiom DESIGN.md forbids, which composites against the page and so flips hover direction between themes. dark:bg-destructive/70makes the dark rest fill translucent.text-whitebypasses--destructive-foreground, which is 2.86:1 against the solid dark--destructivefill.
Why this is filed separately rather than fixed in #2689
The defect is currently unreachable. Every hover here is gated behind [a&]:, which applies only when the Badge renders as an anchor. Auditing the consumers, no Badge in the codebase is a link, and none uses variant="default" or variant="destructive" — every usage is secondary or outline, as a static label:
autocomplete-modal.svelte—secondaryandoutlineimport-settings.svelte,account-settings.svelte—secondary("Coming Soon", "Not available")conflict-indicator-badge.svelte—outlinewith its own amber classes
So unlike #2689 — where variant="destructive" was live on the "Remove database" button and measurably below AA on hover — this one has no user-visible symptom today. It is latent: the first linked default or destructive badge inherits all three defects.
Fix
Mechanical, and the pattern is already established by #2689:
[a&]:hover:bg-primary-hover/[a&]:hover:bg-destructive-hover(tokens already registered intailwind.config.jsby Shared shadcn Button variants use alpha hovers and lose contrast on hover in every variant #2689, so no config work)- Drop
dark:bg-destructive/70, usetext-destructive-foreground secondarykeeps its alpha hover: it is a neutral surface at ~16:1 that gains contrast on hover, not a filled semantic fill — the same carve-outfilled-button-variants.test.tsdocuments
Extending that test to cover badgeVariants is the natural place for the guard.
Acceptance Criteria
-
defaultanddestructivebadge variants hover to their--*-hovertokens - No translucent rest fill on the dark destructive badge
-
destructiveuses--destructive-foregroundrather thantext-white - A test holds
badgeVariantsto the same rule asbuttonVariants
Related
- Shared shadcn Button variants use alpha hovers and lose contrast on hover in every variant #2689 / Add --destructive-hover / --primary-hover tokens and unify filled-button hover states #2673 — the Button fix and the tokens; this is the same defect in the sibling component
Activity
malibio commentedon Sep 17, 2026
Baseline (worktree issue-2704-badge-variants): Frontend 5182 passed, 1 failed — architecture-benchmarks.test.ts render-scaling benchmark, a pre-existing timing flake unrelated to this issue.