diff --git a/plugins/woocommerce-admin/client/components/search/example.md b/plugins/woocommerce-admin/client/components/search/example.md index 8733a676def..c55b38a0374 100644 --- a/plugins/woocommerce-admin/client/components/search/example.md +++ b/plugins/woocommerce-admin/client/components/search/example.md @@ -1,14 +1,14 @@ ```jsx import { Search } from '@woocommerce/components'; -class MySearch extends Component { - updateLocalValue( results ) { - // Do something with results. - } - render() { - return ( - - ); - } -} +const MySearch = withState( { + selected: [], +} )( ( { selected, setState } ) => ( + setState( { selected: items } ) } + /> +) ); ``` diff --git a/plugins/woocommerce-admin/client/components/search/index.js b/plugins/woocommerce-admin/client/components/search/index.js index f4b9f299fd6..3e5ddfb4442 100644 --- a/plugins/woocommerce-admin/client/components/search/index.js +++ b/plugins/woocommerce-admin/client/components/search/index.js @@ -73,8 +73,12 @@ class Search extends Component { render() { const autocompleter = this.getAutocompleter(); - const { ariaLabelledby, placeholder, selected } = this.props; + const { placeholder, selected } = this.props; const { value = '' } = this.state; + const aria = { + 'aria-labelledby': this.props[ 'aria-labelledby' ], + 'aria-label': this.props[ 'aria-label' ], + }; return (
@@ -86,9 +90,9 @@ class Search extends Component { placeholder={ placeholder } className="woocommerce-search__input" onChange={ this.updateSearch( onChange ) } - aria-labelledby={ ariaLabelledby } aria-owns={ listBoxId } aria-activedescendant={ activeId } + { ...aria } /> ) }