diff --git a/src/components/views/rooms/BasicMessageComposer.js b/src/components/views/rooms/BasicMessageComposer.js index d55e9acc86..ec1fd3d276 100644 --- a/src/components/views/rooms/BasicMessageComposer.js +++ b/src/components/views/rooms/BasicMessageComposer.js @@ -265,7 +265,7 @@ export default class BasicMessageEditor extends React.Component { handled = true; // autocomplete or enter to send below shouldn't have any modifier keys pressed. } else if (!(event.metaKey || event.altKey || event.shiftKey)) { - if (model.autoComplete) { + if (model.autoComplete && model.autoComplete.hasCompletions()) { const autoComplete = model.autoComplete; switch (event.key) { case "ArrowUp": diff --git a/src/editor/autocomplete.js b/src/editor/autocomplete.js index 79a69c07a6..a4cbc1cec8 100644 --- a/src/editor/autocomplete.js +++ b/src/editor/autocomplete.js @@ -41,6 +41,11 @@ export default class AutocompleteWrapperModel { return this._getAutocompleterComponent().hasSelection(); } + hasCompletions() { + const ac = this._getAutocompleterComponent(); + return ac && ac.countCompletions() > 0; + } + onEnter() { this._updateCallback({close: true}); }