buzz icon indicating copy to clipboard operation
buzz copied to clipboard

fix(desktop): keep destructive actions readable in light themes

Open brainx opened this issue 4 months ago • 0 comments

Summary

  • keep theme-derived destructive actions at WCAG AA contrast on both the resting menu surface and the focus:bg-muted/50 composite
  • preserve theme colors that already meet the contrast threshold in every rendered state
  • cover GitHub Light and pale deleted-background theme values with regression tests

Root cause

The adaptive theme treated each syntax theme's deleted Git color as foreground text. Some light themes provide a diff-background tint there, so destructive actions could become too pale to read. The focused menu state blends the menu surface with the muted hover color, which also has to be included in the contrast calculation.

Testing

  • node --import ./test-loader.mjs --experimental-strip-types --test src/shared/theme/adaptive-theme.test.mjs — 3 passed, asserting at least 4.5:1 on resting and focused surfaces
  • pnpm exec biome check src/shared/theme/adaptive-theme.ts src/shared/theme/adaptive-theme.test.mjs — passed
  • pnpm build:e2e — passed
  • rendered GitHub Light agent menu — resting Delete action measured at 4.52:1 against the actual menu surface
  • just ci — lint, Rust workspace checks/tests, desktop checks/tests/build, web checks, and mobile checks passed before one unrelated order-dependent Tauri rate-limit test observed a stale 300-second window; the exact failing test passed in isolation

Fixes #2725

brainx avatar Jul 24 '26 21:07 brainx