PLT-7368: Don't clear search box on ESC in Chrome. (#7215)

This commit is contained in:
George Goldberg
2017-08-16 09:18:36 -04:00
committed by Harrison Healey
parent cc3d8a9180
commit 30cfc1aa3e
2 changed files with 9 additions and 3 deletions
+8 -3
View File
@@ -15,7 +15,9 @@ import {getFlaggedPosts, performSearch} from 'actions/post_actions.jsx';
import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
var ActionTypes = Constants.ActionTypes;
const ActionTypes = Constants.ActionTypes;
const KeyCodes = Constants.KeyCodes;
import {Tooltip, OverlayTrigger, Popover} from 'react-bootstrap';
import PropTypes from 'prop-types';
@@ -110,8 +112,11 @@ export default class SearchBar extends React.Component {
});
}
handleKeyDown() {
// This is just to prevent a JS error
handleKeyDown(e) {
if (e.which === KeyCodes.ESCAPE) {
e.stopPropagation();
e.preventDefault();
}
}
handleChange(e) {
@@ -323,6 +323,7 @@ export default class SuggestionBox extends React.Component {
e.preventDefault();
} else if (e.which === KeyCodes.ESCAPE) {
GlobalActions.emitClearSuggestions(this.suggestionId);
e.preventDefault();
e.stopPropagation();
} else if (this.props.onKeyDown) {
this.props.onKeyDown(e);