Skip to content

Badge variants carry the same alpha-hover and text-white defects as Button #2704

Closed

Description

@malibio

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'
  1. Alpha hovers (/90) instead of the --*-hover tokens — the idiom DESIGN.md forbids, which composites against the page and so flips hover direction between themes.
  2. dark:bg-destructive/70 makes the dark rest fill translucent.
  3. text-white bypasses --destructive-foreground, which is 2.86:1 against the solid dark --destructive fill.

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 — secondary and outline
  • import-settings.svelte, account-settings.svelte — secondary ("Coming Soon", "Not available")
  • conflict-indicator-badge.svelte — outline with 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:

Extending that test to cover badgeVariants is the natural place for the guard.

Acceptance Criteria

  • default and destructive badge variants hover to their --*-hover tokens
  • No translucent rest fill on the dark destructive badge
  • destructive uses --destructive-foreground rather than text-white
  • A test holds badgeVariants to the same rule as buttonVariants

Related

Activity

  1. malibio commented on Sep 17, 2026

    @malibio
    CollaboratorAuthor

    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.

  2. self-assigned this
    on Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions