An open source design system that's fully customizable and agent ready
TypeScript
fix(Selector): name the no-search bottom-sheet listbox from the label (#6395)
홍규진e2a4955469cb
diff --git a/.changeset/selector-sheet-listbox-name.md b/.changeset/selector-sheet-listbox-name.mdnew file mode 100644index 0000000000..b523d6196d--- /dev/null+++ b/.changeset/selector-sheet-listbox-name.md@@ -0,0 +1,7 @@+---+'@astryxdesign/core': patch+---++[fix] Name the no-search bottom-sheet `Selector` listbox from the component's `label` so Chromium exposes it with an accessible name; the searchable sheet and popover paths keep their existing trigger relationship.++@kyu-rongdiff --git a/packages/core/src/Selector/Selector.tsx b/packages/core/src/Selector/Selector.tsxindex 3c15352ca1..0461fc49c7 100644--- a/packages/core/src/Selector/Selector.tsx+++ b/packages/core/src/Selector/Selector.tsx@@ -1641,7 +1641,17 @@ export function Selector<T extends SelectorOptionType>(ref={listboxRef}id={listboxId}role="listbox"- aria-labelledby={triggerId}+ // The bottom sheet is a modal layer, so Chromium drops the trigger+ // outside it from the accessibility tree and a reference to it yields+ // no name. Name only this no-search sheet directly from the component's+ // label; the searchable sheet and the popovers keep the trigger+ // relationship.+ aria-label={+ surface.activePresentation === 'bottom-sheet' ? label : undefined+ }+ aria-labelledby={+ surface.activePresentation === 'bottom-sheet' ? undefined : triggerId+ }aria-activedescendant={surface.isOpen && highlightedIndex >= 0? getItemId(highlightedIndex)diff --git a/packages/core/src/Selector/__tests__/Selector.a11y.chromium.spec.ts b/packages/core/src/Selector/__tests__/Selector.a11y.chromium.spec.tsnew file mode 100644index 0000000000..5f9a2c4325--- /dev/null+++ b/packages/core/src/Selector/__tests__/Selector.a11y.chromium.spec.ts@@ -0,0 +1,45 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file Selector.a11y.chromium.spec.ts+ * @input Uses the checked-in no-search bottom-sheet Storybook story and Chromium+ * @output Chromium accessibility-tree regression coverage for the sheet listbox name+ * @position Browser-only accessibility regression test for Selector+ */++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 Selector label', async ({+ page,+}) => {+ await page.goto(+ `${storybook.origin}/iframe.html?id=core-selector--bottom-sheet-presentation&viewMode=story`,+ {waitUntil: 'load'},+ );++ await page.getByRole('combobox', {name: 'Team'}).click();++ const listbox = page.getByRole('listbox');+ await expect(listbox).toBeVisible();+ // Playwright resolves this matcher from Chromium's accessibility tree, not+ // the DOM attribute alone. The sheet is a modal layer, so a reference to the+ // trigger outside it produces no name; this is the regression proof.+ await expect(listbox).toHaveAccessibleName('Team');+});