only pass keyboard to autocomplete when it has selections
otherwise if tab is pressed, try to tab complete the last word
This commit is contained in:
parent
4779880a94
commit
a4376a76f0
2 changed files with 6 additions and 1 deletions
|
@ -265,7 +265,7 @@ export default class BasicMessageEditor extends React.Component {
|
||||||
handled = true;
|
handled = true;
|
||||||
// autocomplete or enter to send below shouldn't have any modifier keys pressed.
|
// autocomplete or enter to send below shouldn't have any modifier keys pressed.
|
||||||
} else if (!(event.metaKey || event.altKey || event.shiftKey)) {
|
} else if (!(event.metaKey || event.altKey || event.shiftKey)) {
|
||||||
if (model.autoComplete) {
|
if (model.autoComplete && model.autoComplete.hasCompletions()) {
|
||||||
const autoComplete = model.autoComplete;
|
const autoComplete = model.autoComplete;
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case "ArrowUp":
|
case "ArrowUp":
|
||||||
|
|
|
@ -41,6 +41,11 @@ export default class AutocompleteWrapperModel {
|
||||||
return this._getAutocompleterComponent().hasSelection();
|
return this._getAutocompleterComponent().hasSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hasCompletions() {
|
||||||
|
const ac = this._getAutocompleterComponent();
|
||||||
|
return ac && ac.countCompletions() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
onEnter() {
|
onEnter() {
|
||||||
this._updateCallback({close: true});
|
this._updateCallback({close: true});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue