Focus search box when opening search header

This commit is contained in:
Robbie Antenesse 2017-06-25 14:48:19 -06:00
parent b8354a3ae5
commit b5d57393c2
1 changed files with 9 additions and 0 deletions

View File

@ -18,6 +18,12 @@ export class SearchBox extends Component {
};
}
componentDidUpdate(prevProps, prevState) {
if (this.state.showHeader && this.searchBox) {
this.searchBox.focus();
}
}
search () {
const {searchingIn, searchTerm, filteredPartsOfSpeech} = this.state;
const searchConfig = {
@ -57,6 +63,9 @@ export class SearchBox extends Component {
</p>
<p className='control is-expanded'>
<input className='input' type='text' placeholder='Search Term'
ref={input => {
this.searchBox = input;
}}
value={this.state.searchTerm}
onChange={event => {
console.log(event);