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

Этот коммит содержится в:
George Goldberg
2017-08-16 14:18:36 +01:00
коммит произвёл Harrison Healey
родитель cc3d8a9180
Коммит 30cfc1aa3e
2 изменённых файлов: 9 добавлений и 3 удалений

Просмотреть файл

@@ -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);