@awsui/components-react
Version:
AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A
16 lines (15 loc) • 639 B
JavaScript
import { generateUniqueId } from '../internal/hooks/use-unique-id';
import { useMemo } from 'react';
export var useDropdownA11yProps = function (listId, open, highlightedOption) {
var id = useMemo(function () { return highlightedOption && generateUniqueId(); }, [highlightedOption]);
var inputProps = useMemo(function () { return ({
'aria-autocomplete': 'list',
'aria-activedescendant': id,
'aria-expanded': open,
'aria-haspopup': 'listbox',
'aria-owns': listId,
role: 'combobox'
}); }, [id, open, listId]);
var itemProps = { id: id };
return [inputProps, itemProps];
};