Skip to content

Commit f64497b

Browse files
authoredOct 14, 2024··
fix(core): use updated aria control attribute for root element (#1278)
1 parent 9658a4d commit f64497b

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed
 

‎packages/autocomplete-core/src/__tests__/getRootProps.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ describe('getRootProps', () => {
4545
expect(rootProps['aria-haspopup']).toEqual('listbox');
4646
});
4747

48-
test('returns undefined aria-owns when panel is closed', () => {
48+
test('returns undefined aria-controls when panel is closed', () => {
4949
const autocomplete = createAutocomplete({
5050
initialState: {
5151
isOpen: false,
5252
},
5353
});
5454
const rootProps = autocomplete.getRootProps({});
5555

56-
expect(rootProps['aria-owns']).toBeUndefined();
56+
expect(rootProps['aria-controls']).toBeUndefined();
5757
});
5858

59-
test('returns list id in aria-owns when panel is open', () => {
59+
test('returns list id in aria-controls when panel is open', () => {
6060
const autocomplete = createAutocomplete({
6161
id: 'autocomplete',
6262
initialState: {
@@ -70,7 +70,7 @@ describe('getRootProps', () => {
7070
});
7171
const rootProps = autocomplete.getRootProps({});
7272

73-
expect(rootProps['aria-owns']).toEqual('autocomplete-testSource-list');
73+
expect(rootProps['aria-controls']).toEqual('autocomplete-testSource-list');
7474
});
7575

7676
test('returns label id in aria-labelledby', () => {

‎packages/autocomplete-core/src/getPropGetters.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export function getPropGetters<
110110
role: 'combobox',
111111
'aria-expanded': store.getState().isOpen,
112112
'aria-haspopup': 'listbox',
113-
'aria-owns': store.getState().isOpen
113+
'aria-controls': store.getState().isOpen
114114
? store
115115
.getState()
116116
.collections.map(({ source }) =>

‎packages/autocomplete-shared/src/core/AutocompletePropGetters.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export type GetRootProps = (props?: { [key: string]: unknown }) => {
4242
| 'listbox'
4343
| 'tree'
4444
| undefined;
45-
'aria-owns': string | undefined;
45+
'aria-controls': string | undefined;
4646
'aria-labelledby': string;
4747
};
4848

0 commit comments

Comments
 (0)
Please sign in to comment.