Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/autocomplete-core/src/__tests__/getRootProps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@ describe('getRootProps', () => {
expect(rootProps['aria-haspopup']).toEqual('listbox');
});

test('returns undefined aria-owns when panel is closed', () => {
test('returns undefined aria-controls when panel is closed', () => {
const autocomplete = createAutocomplete({
initialState: {
isOpen: false,
},
});
const rootProps = autocomplete.getRootProps({});

expect(rootProps['aria-owns']).toBeUndefined();
expect(rootProps['aria-controls']).toBeUndefined();
});

test('returns list id in aria-owns when panel is open', () => {
test('returns list id in aria-controls when panel is open', () => {
const autocomplete = createAutocomplete({
id: 'autocomplete',
initialState: {
Expand All @@ -70,7 +70,7 @@ describe('getRootProps', () => {
});
const rootProps = autocomplete.getRootProps({});

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

test('returns label id in aria-labelledby', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/autocomplete-core/src/getPropGetters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export function getPropGetters<
role: 'combobox',
'aria-expanded': store.getState().isOpen,
'aria-haspopup': 'listbox',
'aria-owns': store.getState().isOpen
'aria-controls': store.getState().isOpen
? store
.getState()
.collections.map(({ source }) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export type GetRootProps = (props?: { [key: string]: unknown }) => {
| 'listbox'
| 'tree'
| undefined;
'aria-owns': string | undefined;
'aria-controls': string | undefined;
'aria-labelledby': string;
};

Expand Down