Act on blur on search field

This commit is contained in:
David Kaltschmidt
2016-05-13 09:48:14 +02:00
parent 3473beec98
commit 01c9cac0ba

View File

@@ -42,6 +42,7 @@ class Search extends React.Component {
constructor(props, context) {
super(props, context);
this.handleBlur = this.handleBlur.bind(this);
this.handleChange = this.handleChange.bind(this);
this.handleFocus = this.handleFocus.bind(this);
this.doSearch = _.debounce(this.doSearch.bind(this), 200);
@@ -50,6 +51,10 @@ class Search extends React.Component {
};
}
handleBlur() {
this.props.blurSearch();
}
handleChange(ev) {
const inputValue = ev.target.value;
let value = inputValue;
@@ -119,7 +124,7 @@ class Search extends React.Component {
.map(query => <SearchItem query={query} key={query} />)}
<input className="search-input-field" type="text" id={inputId}
value={value} onChange={this.handleChange}
onFocus={this.handleFocus}
onFocus={this.handleFocus} onBlur={this.handleBlur}
disabled={disabled} ref="queryInput" />
</div>
{!showPinnedSearches && <div className="search-hint">