From 97290cc0fd950164f3ef88751da0a5136eae7d93 Mon Sep 17 00:00:00 2001 From: Ivditi Gabeskiria Date: Thu, 6 Jun 2019 19:47:39 -0400 Subject: [PATCH 1/4] added aria label --- src/Autosuggest.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Autosuggest.js b/src/Autosuggest.js index bdaffd58..ad7cda8c 100644 --- a/src/Autosuggest.js +++ b/src/Autosuggest.js @@ -54,6 +54,7 @@ export default class Autosuggest extends Component { shouldRenderSuggestions: PropTypes.func, alwaysRenderSuggestions: PropTypes.bool, multiSection: PropTypes.bool, + ariaLabel: PropTypes.string, renderSectionTitle: (props, propName) => { const renderSectionTitle = props[propName]; @@ -92,6 +93,7 @@ export default class Autosuggest extends Component { focusInputOnSuggestionClick: true, highlightFirstSuggestion: false, theme: defaultTheme, + ariaLabel: 'search', id: '1' }; @@ -515,6 +517,7 @@ export default class Autosuggest extends Component { theme, getSuggestionValue, alwaysRenderSuggestions, + ariaLabel, highlightFirstSuggestion } = this.props; const { @@ -755,6 +758,7 @@ export default class Autosuggest extends Component { itemProps={this.itemProps} theme={mapToAutowhateverTheme(theme)} id={id} + ariaLabel={ariaLabel} ref={this.storeAutowhateverRef} /> ); From 4d0dd5a7ecdcd60153ed593b69de2e00425f65ec Mon Sep 17 00:00:00 2001 From: Ivditi Gabeskiria Date: Thu, 6 Jun 2019 19:50:39 -0400 Subject: [PATCH 2/4] updated README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index da582464..e5f5711f 100644 --- a/README.md +++ b/README.md @@ -168,6 +168,7 @@ class Example extends React.Component { | [`renderInputComponent`](#render-input-component-prop) | Function | | Use it only if you need to customize the rendering of the input. | | [`renderSuggestionsContainer`](#render-suggestions-container-prop) | Function | | Use it if you want to customize things inside the suggestions container beyond rendering the suggestions themselves. | | [`theme`](#theme-prop) | Object | | Use your imagination to style the Autosuggest. | +| [`ariaLabel`] | String | | Use it if you need to set an aria-label to select box. | | [`id`](#id-prop) | String | | Use it only if you have multiple Autosuggest components on a page. | From 4cafb3575df4a3eb6c6b9232f1721934fd5d3e09 Mon Sep 17 00:00:00 2001 From: Ivditi Gabeskiria Date: Thu, 6 Jun 2019 19:58:23 -0400 Subject: [PATCH 3/4] updated README to include an example --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e5f5711f..cc17d29d 100644 --- a/README.md +++ b/README.md @@ -168,7 +168,7 @@ class Example extends React.Component { | [`renderInputComponent`](#render-input-component-prop) | Function | | Use it only if you need to customize the rendering of the input. | | [`renderSuggestionsContainer`](#render-suggestions-container-prop) | Function | | Use it if you want to customize things inside the suggestions container beyond rendering the suggestions themselves. | | [`theme`](#theme-prop) | Object | | Use your imagination to style the Autosuggest. | -| [`ariaLabel`] | String | | Use it if you need to set an aria-label to select box. | +| [`ariaLabel`](#aria-label-prop) | String | | Use it if you need to set an aria-label to select box. | | [`id`](#id-prop) | String | | Use it only if you have multiple Autosuggest components on a page. | @@ -608,6 +608,11 @@ The following picture illustrates how `theme` keys correspond to Autosuggest DOM ![DOM structure](dom-structure.png) + +#### theme (optional) + +Aria-label can be added to props, so that the input field of AutoSuggest is accessible. By default it is set to `search`. + #### id (required when multiple Autosuggest components are rendered on a page) From 2e1a8d8ca7648eb23777e123bfd02c41c0b58a9a Mon Sep 17 00:00:00 2001 From: Ivditi Gabeskiria Date: Thu, 6 Jun 2019 20:00:39 -0400 Subject: [PATCH 4/4] fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cc17d29d..c09ea8c1 100644 --- a/README.md +++ b/README.md @@ -609,7 +609,7 @@ The following picture illustrates how `theme` keys correspond to Autosuggest DOM ![DOM structure](dom-structure.png) -#### theme (optional) +#### ariaLabel (optional) Aria-label can be added to props, so that the input field of AutoSuggest is accessible. By default it is set to `search`.