Skip to content

Commit 3f226c9

Browse files
rivka-ungarclaude
andcommitted
fix(Dropdown): expose selected chips as a labelled group
Mark the chips container with role="group" and aria-label="selected items" so assistive tech announces the chips as a named group. Adds an optional role prop pass-through to Flex to support this. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 33aa013 commit 3f226c9

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

packages/components/layout/src/Flex/Flex.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ export interface FlexProps extends VibeComponentProps {
6363
* ID of the element describing the flex container.
6464
*/
6565
"aria-labelledby"?: string;
66+
/**
67+
* The ARIA role of the flex container.
68+
*/
69+
role?: React.AriaRole;
6670
}
6771

6872
const Flex = forwardRef(
@@ -83,6 +87,7 @@ const Flex = forwardRef(
8387
style,
8488
"aria-labelledby": ariaLabelledby,
8589
"aria-label": ariaLabel,
90+
role,
8691
tabIndex,
8792
"data-testid": dataTestId
8893
}: FlexProps,
@@ -153,6 +158,7 @@ const Flex = forwardRef(
153158
onMouseDown={onMouseDown}
154159
style={overrideStyle}
155160
aria-label={ariaLabel}
161+
role={role}
156162
>
157163
{children}
158164
</Element>

packages/core/src/components/Dropdown/__tests__/Dropdown.test.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,15 @@ describe("DropdownNew", () => {
788788
expect(getByTestId("dropdown-chip-item3")).toBeInTheDocument();
789789
});
790790

791+
it("should expose the chips as a group labelled \"selected items\"", () => {
792+
const { getByRole, getByPlaceholderText, getByText } = renderDropdown({ multi: true });
793+
794+
fireEvent.click(getByPlaceholderText("Select an option"));
795+
fireEvent.click(getByText("Option 1"));
796+
797+
expect(getByRole("group", { name: "selected items" })).toBeInTheDocument();
798+
});
799+
791800
describe("interactiveChips", () => {
792801
it("should expose a short selection summary as the combobox value", () => {
793802
const { getByRole } = renderDropdown({ multi: true, interactiveChips: true });

packages/core/src/components/Dropdown/components/MultiSelectedValues/MultiSelectedValues.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ function MultiSelectedValues<Item extends BaseItemData<Record<string, unknown>>>
119119
wrap={false}
120120
gap="xs"
121121
ref={containerRef}
122+
role="group"
123+
aria-label="selected items"
122124
className={cx(styles.containerWrapper, {
123125
[styles.singleChip]: isSingleChip,
124126
[styles.measuring]: !hasMeasured

0 commit comments

Comments
 (0)