An open source design system that's fully customizable and agent ready
TypeScript
fix(ui): name bottom-sheet multi-selector listbox (#6389)
이동욱609f8b364d32
diff --git a/.changeset/multi-selector-bottom-sheet-listbox-name.md b/.changeset/multi-selector-bottom-sheet-listbox-name.mdnew file mode 100644index 0000000000..4b0fdc1883--- /dev/null+++ b/.changeset/multi-selector-bottom-sheet-listbox-name.md@@ -0,0 +1,7 @@+---+'@astryxdesign/core': patch+---++[fix] MultiSelector: name the listbox of a bottom sheet without search from the component's label, so screen readers announce it++@Lee-Dongwookdiff --git a/packages/core/src/MultiSelector/MultiSelector.tsx b/packages/core/src/MultiSelector/MultiSelector.tsxindex e04f60b1a9..4469f2f1e7 100644--- a/packages/core/src/MultiSelector/MultiSelector.tsx+++ b/packages/core/src/MultiSelector/MultiSelector.tsx@@ -2009,7 +2009,14 @@ export function MultiSelector<T extends MultiSelectorOptionType>({id={listboxId}role="listbox"aria-multiselectable="true"- {...listboxLabelProps}+ // The bottom sheet is rendered in a modal layer, so Chromium cannot+ // reliably compute this listbox's name from the trigger outside that+ // layer. Name only this no-search sheet directly from the component's+ // existing label; searchable sheets and popovers retain their current+ // trigger relationship.+ {...(surface.activePresentation === 'bottom-sheet'+ ? {'aria-label': label}+ : listboxLabelProps)}aria-activedescendant={surface.isOpen && highlightedIndex >= 0? getItemId(highlightedIndex)diff --git a/packages/core/src/MultiSelector/__tests__/MultiSelector.a11y.chromium.spec.ts b/packages/core/src/MultiSelector/__tests__/MultiSelector.a11y.chromium.spec.tsnew file mode 100644index 0000000000..c786959124--- /dev/null+++ b/packages/core/src/MultiSelector/__tests__/MultiSelector.a11y.chromium.spec.ts@@ -0,0 +1,45 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file MultiSelector.a11y.chromium.spec.ts+ * @input Uses the checked-in no-search bottom-sheet Storybook fixture and Chromium+ * @output Chromium accessibility-tree regression coverage for the sheet listbox name+ * @position Browser-only accessibility regression test for MultiSelector+ */++import {expect, test} from '@playwright/test';+import {+ DEFAULT_STORYBOOK_DIR,+ serveStorybook,+ type StaticServer,+} from '@astryxdesign/a11y-spec/storybook';++let storybook: StaticServer;++test.beforeAll(async () => {+ storybook = await serveStorybook(+ process.env.ASTRYX_STORYBOOK_DIR ?? DEFAULT_STORYBOOK_DIR,+ );+});++test.afterAll(async () => {+ await storybook?.close();+});++test('names the no-search bottom-sheet listbox from the MultiSelector label', async ({+ page,+}) => {+ await page.goto(+ `${storybook.origin}/iframe.html?id=core-multiselector--bottom-sheet-presentation&viewMode=story`,+ {waitUntil: 'load'},+ );++ await page.getByRole('combobox', {name: 'Teams'}).click();++ const listbox = page.getByRole('listbox');+ await expect(listbox).toBeVisible();+ // Playwright resolves this matcher from Chromium's accessibility tree, not+ // the DOM attribute alone. Keep this as the regression proof for the modal+ // layer's formerly unnamed listbox.+ await expect(listbox).toHaveAccessibleName('Teams');+});