Fix issue #2758. Press Escape after a finished search to get back to … (#2939)

* Fix issue #2758. Press Escape after a finished search to get back to Inbox

Use a keydown event when search bar is in focus to capture escape key press

* fix(search): Convert to ES2016
This commit is contained in:
Yishu See 2016-10-27 02:57:57 +08:00 committed by Ben Gotow
parent 48db9ecd9f
commit 6377da8291

View file

@ -90,6 +90,12 @@ export default class SearchBar extends React.Component {
}, 150);
}
_onKeyDown = (event) => {
if (event.keyCode === 27) {
this._onClearAndBlur();
}
}
_doSearch = () => {
SearchActions.querySubmitted(this.state.query);
}
@ -142,6 +148,7 @@ export default class SearchBar extends React.Component {
onChange={this._onValueChange}
onFocus={this._onFocus}
onBlur={this._onBlur}
onKeyDown={this._onKeyDown}
/>,
loupeImg,
<RetinaImg