An open source design system that's fully customizable and agent ready
TypeScript
fix(CommandPaletteList): preserve standalone ids (#6988)
zakelstorm2b3b175f301b
diff --git a/.changeset/preserve-consumer-ids-on-standalone-commandpalet-3os9.md b/.changeset/preserve-consumer-ids-on-standalone-commandpalet-3os9.mdnew file mode 100644index 0000000000..366090e51d--- /dev/null+++ b/.changeset/preserve-consumer-ids-on-standalone-commandpalet-3os9.md@@ -0,0 +1,6 @@+---+'@astryxdesign/core': patch+---++[fix] Preserve consumer ids on standalone CommandPaletteList while retaining the managed ARIA id inside CommandPalette+@korkt-kimdiff --git a/packages/core/src/CommandPalette/CommandPaletteList.test.tsx b/packages/core/src/CommandPalette/CommandPaletteList.test.tsxindex 0f93b26aea..cf0ffc161b 100644--- a/packages/core/src/CommandPalette/CommandPaletteList.test.tsx+++ b/packages/core/src/CommandPalette/CommandPaletteList.test.tsx@@ -34,6 +34,19 @@ describe('CommandPaletteList', () => {expect(screen.getByRole('listbox')).toBeInTheDocument();});+ it('preserves the consumer id when used standalone', () => {+ render(+ <CommandPaletteList id="custom-commands">+ <div>Item</div>+ </CommandPaletteList>,+ );++ expect(screen.getByRole('listbox')).toHaveAttribute(+ 'id',+ 'custom-commands',+ );+ });+it('has default aria-label', () => {render(<CommandPaletteList>diff --git a/packages/core/src/CommandPalette/CommandPaletteList.tsx b/packages/core/src/CommandPalette/CommandPaletteList.tsxindex 9382c36a26..1e2061daf9 100644--- a/packages/core/src/CommandPalette/CommandPaletteList.tsx+++ b/packages/core/src/CommandPalette/CommandPaletteList.tsx@@ -89,7 +89,7 @@ export function CommandPaletteList({<divref={ref}{...props}- id={ctx?.listId}+ id={ctx?.listId ?? props.id}role="listbox"aria-label={label}{...mergeProps(