From 5c30df25f1b89fd5c46f4e421f8bae38fc3bf577 Mon Sep 17 00:00:00 2001 From: Ivditi Gabeskiria Date: Thu, 6 Jun 2019 20:06:12 -0400 Subject: [PATCH] added aria-label for combobox and inner container of suggestions --- src/Autowhatever.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Autowhatever.js b/src/Autowhatever.js index eb295c7..ec2b2b2 100644 --- a/src/Autowhatever.js +++ b/src/Autowhatever.js @@ -39,6 +39,7 @@ export default class Autowhatever extends Component { getSectionItems: PropTypes.func, // This function gets a section and returns its items, which will be passed into `renderItem` for rendering. containerProps: PropTypes.object, // Arbitrary container props inputProps: PropTypes.object, // Arbitrary input props + ariaLabel: PropTypes.string, // Sets aria-label itemProps: PropTypes.oneOfType([ // Arbitrary item props PropTypes.object, PropTypes.func @@ -71,6 +72,7 @@ export default class Autowhatever extends Component { itemProps: emptyObject, highlightedSectionIndex: null, highlightedItemIndex: null, + ariaLabel: 'search', theme: defaultTheme }; @@ -300,7 +302,7 @@ export default class Autowhatever extends Component { const { theme } = this; const { id, multiSection, renderInputComponent, renderItemsContainer, - highlightedSectionIndex, highlightedItemIndex + highlightedSectionIndex, highlightedItemIndex, ariaLabel } = this.props; const { isInputFocused } = this.state; const renderedItems = multiSection ? this.renderSections() : this.renderItems(); @@ -312,6 +314,7 @@ export default class Autowhatever extends Component { 'aria-haspopup': 'listbox', 'aria-owns': itemsContainerId, 'aria-expanded': isOpen, + 'aria-label': ariaLabel, ...theme( `react-autowhatever-${id}-container`, 'container', @@ -325,6 +328,7 @@ export default class Autowhatever extends Component { autoComplete: 'off', 'aria-autocomplete': 'list', 'aria-controls': itemsContainerId, + 'aria-label' : 'suggestions', 'aria-activedescendant': ariaActivedescendant, ...theme( `react-autowhatever-${id}-input`,