mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 02:00:43 +00:00
Act on blur on search field
This commit is contained in:
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user