Fix Search filter; focus search box on open

This commit is contained in:
Robbie Antenesse 2018-03-09 11:50:46 -07:00
parent 6c21e4feec
commit fba6063f55
1 changed files with 4 additions and 2 deletions

View File

@ -23,7 +23,7 @@ export class SearchBox extends Component {
searchTerm: '', searchTerm: '',
caseSensitive: false, caseSensitive: false,
ignoreDiacritics: false, ignoreDiacritics: false,
filteredPartsOfSpeech: [...props.partsOfSpeech, 'Uncategorized'], filteredPartsOfSpeech: this.partsOfSpeechForFilter,
showHeader: false, showHeader: false,
showAdvanced: false, showAdvanced: false,
}; };
@ -62,7 +62,7 @@ export class SearchBox extends Component {
} }
togglePartOfSpeech (event) { togglePartOfSpeech (event) {
const uniquePartsOfSpeech = new Set(this.partsOfSpeechForFilter); const uniquePartsOfSpeech = new Set(this.state.filteredPartsOfSpeech);
if (event.target.checked) { if (event.target.checked) {
uniquePartsOfSpeech.add(event.target.value); uniquePartsOfSpeech.add(event.target.value);
} else { } else {
@ -314,6 +314,8 @@ export class SearchBox extends Component {
showHeader () { showHeader () {
this.setState({ this.setState({
showHeader: true, showHeader: true,
}, () => {
this.searchBox.focus();
}); });
} }