Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(Kbd): support literal "+" key via "plus" alias (#2413)

Andrey Goderb2338b492719
diff --git a/packages/core/src/Kbd/XDSKbd.test.tsx b/packages/core/src/Kbd/XDSKbd.test.tsx
index 01f1fa5e45..6d179302c8 100644
--- a/packages/core/src/Kbd/XDSKbd.test.tsx
+++ b/packages/core/src/Kbd/XDSKbd.test.tsx
@@ -95,4 +95,10 @@ describe('XDSKbd', () => {
const wrapper = container.firstChild as HTMLElement;
expect(wrapper.className).toContain('xds-kbd');
});
+
+ it('renders "plus" as a literal + key', () => {
+ render(<XDSKbd keys="shift+plus" />);
+ expect(screen.getByText('⇧')).toBeInTheDocument();
+ expect(screen.getByText('+')).toBeInTheDocument();
+ });
});
diff --git a/packages/core/src/Kbd/XDSKbd.tsx b/packages/core/src/Kbd/XDSKbd.tsx
index 39a67d7aeb..8ecf2073c6 100644
--- a/packages/core/src/Kbd/XDSKbd.tsx
+++ b/packages/core/src/Kbd/XDSKbd.tsx
@@ -71,6 +71,7 @@ const KEY_DISPLAY: Record<string, string> = {
down: '\u2193',
left: '\u2190',
right: '\u2192',
+ plus: '+',
};
/**
@@ -116,11 +117,13 @@ export interface XDSKbdProps extends XDSBaseProps<HTMLSpanElement> {
/**
* Keyboard shortcut string. Use "+" to separate keys.
* Special keys: mod (Cmd on Mac), ctrl, alt, shift, enter, backspace, escape.
+ * Use "plus" to render a literal "+" key (e.g. "shift+plus").
*
* @example
* ```
* "mod+k"
* "mod+shift+p"
+ * "shift+plus"
* "enter"
* ```
*/