Button destructive label binds Foregrounds/White (WEB-1326)
Version: 0.9.1 ยท Type: ๐ Bug Fix
Problemโ
The destructive button (variant="destructive") rendered black text on its red fill in dark mode, making the label nearly unreadable.
Changed Filesโ
packages/design/src/components/Button/styles.tspackages/design/src/components/Button/ButtonDesignSpec.mdpackages/design/src/components/Button/__tests__/Button.test.tsx
Changesโ
BUTTON_VARIANT_CLASS.destructivedeclared the label astext-(--Labels-Reverse), which resolves to#FFFFFFin light mode but inverts to#000000in dark mode, while the--Labels-Errorfill underneath stays red in both modes โ hence black-on-red in dark mode.- Verified against the Figma design system file (
5ssRkvUdqpsRwwW59ooQCp): the Destructive label fill bindsForegrounds/White(VariableID:17:7,#FFFFFFin both modes) on Default (147:15406/147:15409/147:15412/20935:1635) and on Hover / Clicked (147:15424/147:15433). Changedtext-(--Labels-Reverse)totext-(--Foregrounds-White)accordingly, with a comment noting the label stays white regardless of mode. primarykeepstext-(--Labels-Reverse): Figma binds the Primary label toLabels/Reverse(VariableID:14:5, node147:15379), and its fill inverts with the mode, so the label has to invert with it.- Recorded
Foregrounds/Whiteand a per-variant text color token table (Primary, Destructive Default/Hover/Clicked, Destructive Outline, Loading/Disabled) inButtonDesignSpec.md. - Added a unit test asserting the destructive button carries
text-(--Foregrounds-White)and no longertext-(--Labels-Reverse).
Impactโ
- In dark mode,
variant="destructive"buttons now render white text on the red fill instead of black. - Light mode is visually unchanged (
Foregrounds/WhiteandLabels/Reverseare both#FFFFFFthere). primaryis unaffected and still usesLabels/Reverse.