Fixed SuggestionBox keyboard handlers when there are no suggestions available
Этот коммит содержится в:
@@ -109,24 +109,28 @@ export default class SuggestionBox extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleKeyDown(e) {
|
handleKeyDown(e) {
|
||||||
if (e.which === KeyCodes.UP) {
|
if (SuggestionStore.hasSuggestions(this.suggestionId)) {
|
||||||
AppDispatcher.handleViewAction({
|
if (e.which === KeyCodes.UP) {
|
||||||
type: ActionTypes.SUGGESTION_SELECT_PREVIOUS,
|
AppDispatcher.handleViewAction({
|
||||||
id: this.suggestionId
|
type: ActionTypes.SUGGESTION_SELECT_PREVIOUS,
|
||||||
});
|
id: this.suggestionId
|
||||||
e.preventDefault();
|
});
|
||||||
} else if (e.which === KeyCodes.DOWN) {
|
e.preventDefault();
|
||||||
AppDispatcher.handleViewAction({
|
} else if (e.which === KeyCodes.DOWN) {
|
||||||
type: ActionTypes.SUGGESTION_SELECT_NEXT,
|
AppDispatcher.handleViewAction({
|
||||||
id: this.suggestionId
|
type: ActionTypes.SUGGESTION_SELECT_NEXT,
|
||||||
});
|
id: this.suggestionId
|
||||||
e.preventDefault();
|
});
|
||||||
} else if ((e.which === KeyCodes.SPACE || e.which === KeyCodes.ENTER) && SuggestionStore.hasSuggestions(this.suggestionId)) {
|
e.preventDefault();
|
||||||
AppDispatcher.handleViewAction({
|
} else if (e.which === KeyCodes.SPACE || e.which === KeyCodes.ENTER) {
|
||||||
type: ActionTypes.SUGGESTION_COMPLETE_WORD,
|
AppDispatcher.handleViewAction({
|
||||||
id: this.suggestionId
|
type: ActionTypes.SUGGESTION_COMPLETE_WORD,
|
||||||
});
|
id: this.suggestionId
|
||||||
e.preventDefault();
|
});
|
||||||
|
e.preventDefault();
|
||||||
|
} else if (this.props.onKeyDown) {
|
||||||
|
this.props.onKeyDown(e);
|
||||||
|
}
|
||||||
} else if (this.props.onKeyDown) {
|
} else if (this.props.onKeyDown) {
|
||||||
this.props.onKeyDown(e);
|
this.props.onKeyDown(e);
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user