Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(ui): tint Kbd from currentColor inside primary buttons (MUL-9809) (#11154)
Jiayuan Zhang82a3fd4f992b
diff --git a/apps/storybook/src/kbd/variants.tsx b/apps/storybook/src/kbd/variants.tsxindex cd93e7cd87..18085bcf9c 100644--- a/apps/storybook/src/kbd/variants.tsx+++ b/apps/storybook/src/kbd/variants.tsx@@ -184,7 +184,7 @@ const TONE_CLASSES: Record<DemoTone, string> = {subtle:"border border-input/85 bg-muted/70 text-muted-foreground shadow-[0_1px_0_0_color-mix(in_oklab,var(--input)_75%,transparent)]","on-primary":- "border border-primary-foreground/25 bg-primary-foreground/14 text-primary-foreground shadow-none",+ "border border-current/25 bg-current/14 text-current shadow-none",tooltip:"border border-white/14 bg-white/10 text-tooltip-foreground/90 shadow-none",};@@ -390,7 +390,6 @@ export function DemoLiteralKbd({return (<Kbdsize={size}- tone={tone === "on-primary" ? "on-primary" : "default"}compactclassName={tone === "tooltip" ? TONE_CLASSES.tooltip : undefined}>diff --git a/packages/ui/components/ui/kbd.test.tsx b/packages/ui/components/ui/kbd.test.tsxindex 679853ee6b..90312e09db 100644--- a/packages/ui/components/ui/kbd.test.tsx+++ b/packages/ui/components/ui/kbd.test.tsx@@ -12,16 +12,24 @@ describe("Kbd", () => {expect(kbd.className).toContain("in-data-[slot=tooltip-content]:bg-white/10!");});- it("supports md size, compact padding, and on-primary tone", () => {+ it("supports md size and compact padding", () => {const { container } = render(- <Kbd size="md" tone="on-primary" compact>+ <Kbd size="md" compact>K</Kbd>,);const kbd = container.querySelector("[data-slot='kbd']") as HTMLElement;expect(kbd.className).toContain("h-[2.15em]");expect(kbd.className).toContain("px-[0.42em]");- expect(kbd.className).toContain("text-primary-foreground");+ });++ it("takes its ink from currentColor inside a primary button", () => {+ const { container } = render(<Kbd>K</Kbd>);+ const kbd = container.querySelector("[data-slot='kbd']") as HTMLElement;+ const inPrimary = "in-[[data-slot=button][data-variant=default]]";+ expect(kbd.className).toContain(`${inPrimary}:text-current!`);+ expect(kbd.className).toContain(`${inPrimary}:bg-current/14!`);+ expect(kbd.className).toContain(`${inPrimary}:border-current/25!`);});it("renders every optical glyph with proportional em width and shared 16-unit height", () => {diff --git a/packages/ui/components/ui/kbd.tsx b/packages/ui/components/ui/kbd.tsxindex 1cb309ef9e..cfba409a9d 100644--- a/packages/ui/components/ui/kbd.tsx+++ b/packages/ui/components/ui/kbd.tsx@@ -17,7 +17,6 @@ export type KbdGlyphName =| "space";export type KbdSize = "sm" | "md";-export type KbdTone = "default" | "on-primary";interface KbdGlyphSpec {/** Proportional advance width on a shared 16-unit vertical em-box. */@@ -168,7 +167,6 @@ const KBD_CASE_STYLE: CSSProperties = {interface KbdProps extends React.ComponentProps<"kbd"> {size?: KbdSize;- tone?: KbdTone;/** Tighter horizontal padding for single-glyph / single-character keycaps. */compact?: boolean;}@@ -176,7 +174,6 @@ interface KbdProps extends React.ComponentProps<"kbd"> {function Kbd({className,size = "sm",- tone = "default",compact = false,style,...props@@ -187,15 +184,15 @@ function Kbd({style={style ? { ...KBD_CASE_STYLE, ...style } : KBD_CASE_STYLE}className={cn("pointer-events-none inline-flex w-fit items-center justify-center font-sans leading-none font-medium tracking-[-0.01em] select-none [&_svg:not([data-kbd-glyph]):not([class*='size-'])]:size-[1.1em]",- tone === "on-primary"- ? "border border-primary-foreground/25 bg-primary-foreground/14 text-primary-foreground shadow-none"- : [- "border border-input bg-card text-muted-foreground shadow-[0_1px_0_0_color-mix(in_oklab,var(--input)_85%,transparent)]",- "dark:border-white/12 dark:bg-surface-raised dark:shadow-[0_1px_0_0_rgb(0_0_0/0.5)]",- // Tooltips use a dark surface in both themes; override both light and- // dark default styles so keycaps stay crisp without passing a tone.- "in-data-[slot=tooltip-content]:border-white/14! in-data-[slot=tooltip-content]:bg-white/10! in-data-[slot=tooltip-content]:text-tooltip-foreground/90! in-data-[slot=tooltip-content]:shadow-none!",- ],+ "border border-input bg-card text-muted-foreground shadow-[0_1px_0_0_color-mix(in_oklab,var(--input)_85%,transparent)]",+ "dark:border-white/12 dark:bg-surface-raised dark:shadow-[0_1px_0_0_rgb(0_0_0/0.5)]",+ // Tooltips use a dark surface in both themes; override both light and+ // dark default styles so keycaps stay crisp without passing a tone.+ "in-data-[slot=tooltip-content]:border-white/14! in-data-[slot=tooltip-content]:bg-white/10! in-data-[slot=tooltip-content]:text-tooltip-foreground/90! in-data-[slot=tooltip-content]:shadow-none!",+ // Themes recolor the primary button through --button-primary-foreground+ // (appearance.css), which --primary-foreground does not follow; deriving+ // from the label's currentColor keeps the keycap legible on every theme.+ "in-[[data-slot=button][data-variant=default]]:border-current/25! in-[[data-slot=button][data-variant=default]]:bg-current/14! in-[[data-slot=button][data-variant=default]]:text-current! in-[[data-slot=button][data-variant=default]]:shadow-none!",size === "md"? cn("h-[2.15em] min-w-[2.15em] gap-[0.34em] rounded-md text-caption",diff --git a/packages/views/common/shortcut-keycaps.tsx b/packages/views/common/shortcut-keycaps.tsxindex 9cc85be31c..c96a21f735 100644--- a/packages/views/common/shortcut-keycaps.tsx+++ b/packages/views/common/shortcut-keycaps.tsx@@ -13,7 +13,6 @@ import {KbdGlyph,type KbdGlyphName,type KbdSize,- type KbdTone,} from "@multica/ui/components/ui/kbd";import { cn } from "@multica/ui/lib/utils";@@ -95,7 +94,6 @@ export function ShortcutKeycaps({platform = getShortcutPlatform(),size = "sm",layout = "pill",- tone = "default",decorative = false,className,keyClassName,@@ -109,7 +107,6 @@ export function ShortcutKeycaps({* shortcut recording where individual physical keys are the subject.*/layout?: ShortcutKeycapsLayout;- tone?: KbdTone;/** Hide a redundant hint when its parent already names the action. */decorative?: boolean;className?: string;@@ -132,7 +129,6 @@ export function ShortcutKeycaps({<Kbdaria-hidden="true"size={size}- tone={tone}compact={compact}className={keyClassName}>@@ -167,7 +163,6 @@ export function ShortcutKeycaps({title={token.label}data-shortcut-key={token.id}size={size}- tone={tone}compact={isSingleCompactToken(token)}className={keyClassName}>diff --git a/packages/views/issues/components/annotation-composer.tsx b/packages/views/issues/components/annotation-composer.tsxindex 45958d44e7..17a2a6ad99 100644--- a/packages/views/issues/components/annotation-composer.tsx+++ b/packages/views/issues/components/annotation-composer.tsx@@ -151,7 +151,7 @@ export function AnnotationComposer({<Button size="sm" disabled={!annotation.note.trim() || !canSave || busy} onClick={save}aria-label={t(($) => existing ? $.reply.annotations.save : $.reply.annotations.confirm_add)}>{t(($) => existing ? $.reply.annotations.save_short : $.reply.annotations.confirm_add_short)}- <ShortcutKeycaps shortcut={ENTER} tone="on-primary" decorative />+ <ShortcutKeycaps shortcut={ENTER} decorative /></Button></div></div>}diff --git a/packages/views/issues/components/wakeup-create.tsx b/packages/views/issues/components/wakeup-create.tsxindex ddb8b38d2a..8f3000ce91 100644--- a/packages/views/issues/components/wakeup-create.tsx+++ b/packages/views/issues/components/wakeup-create.tsx@@ -353,7 +353,6 @@ export function WakeupCreateForm({{sendShortcut && !create.isPending ? (<ShortcutKeycapsshortcut={sendShortcut}- tone="on-primary"decorativeclassName="ml-1 max-sm:hidden"/>diff --git a/packages/views/modals/create-issue.tsx b/packages/views/modals/create-issue.tsxindex c183585ac6..6c0b7f0a5c 100644--- a/packages/views/modals/create-issue.tsx+++ b/packages/views/modals/create-issue.tsx@@ -983,7 +983,6 @@ export function ManualCreatePanel({{sendShortcut ? (<ShortcutKeycapsshortcut={sendShortcut}- tone="on-primary"decorativeclassName="ml-1 max-sm:hidden"/>diff --git a/packages/views/modals/feedback.tsx b/packages/views/modals/feedback.tsxindex 797a695433..ee6f5ed319 100644--- a/packages/views/modals/feedback.tsx+++ b/packages/views/modals/feedback.tsx@@ -199,7 +199,6 @@ export function FeedbackModal({{sendShortcut ? (<ShortcutKeycapsshortcut={sendShortcut}- tone="on-primary"decorativeclassName="ml-1"/>diff --git a/packages/views/modals/quick-create-issue.tsx b/packages/views/modals/quick-create-issue.tsxindex 9a0f93a49c..614cd5b1ed 100644--- a/packages/views/modals/quick-create-issue.tsx+++ b/packages/views/modals/quick-create-issue.tsx@@ -679,7 +679,6 @@ export function AgentCreatePanel({// footer reflows at.<ShortcutKeycapsshortcut={sendShortcut}- tone="on-primary"decorativeclassName="ml-1 max-sm:hidden"/>diff --git a/packages/views/modals/run-confirm.tsx b/packages/views/modals/run-confirm.tsxindex de53d1a47d..5059d8a81b 100644--- a/packages/views/modals/run-confirm.tsx+++ b/packages/views/modals/run-confirm.tsx@@ -262,7 +262,6 @@ export function RunConfirmModal({{sendShortcut ? (<ShortcutKeycapsshortcut={sendShortcut}- tone="on-primary"decorativeclassName="ml-1"/>