mirror of https://github.com/vector-im/riot-web
Merge pull request #384 from aviraldg/fix-composer-up-down
fix: allow up/down normally for no completionspull/21833/head
commit
efdcc6da98
|
@ -64,6 +64,9 @@ export default class Autocomplete extends React.Component {
|
|||
onUpArrow(): boolean {
|
||||
let completionCount = this.countCompletions(),
|
||||
selectionOffset = (completionCount + this.state.selectionOffset - 1) % completionCount;
|
||||
if (!completionCount) {
|
||||
return false;
|
||||
}
|
||||
this.setSelection(selectionOffset);
|
||||
return true;
|
||||
}
|
||||
|
@ -72,6 +75,9 @@ export default class Autocomplete extends React.Component {
|
|||
onDownArrow(): boolean {
|
||||
let completionCount = this.countCompletions(),
|
||||
selectionOffset = (this.state.selectionOffset + 1) % completionCount;
|
||||
if (!completionCount) {
|
||||
return false;
|
||||
}
|
||||
this.setSelection(selectionOffset);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -497,18 +497,14 @@ export default class MessageComposerInput extends React.Component {
|
|||
}
|
||||
|
||||
onUpArrow(e) {
|
||||
if(this.props.onUpArrow) {
|
||||
if(this.props.onUpArrow()) {
|
||||
e.preventDefault();
|
||||
}
|
||||
if (this.props.onUpArrow && this.props.onUpArrow()) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
onDownArrow(e) {
|
||||
if(this.props.onDownArrow) {
|
||||
if(this.props.onDownArrow()) {
|
||||
e.preventDefault();
|
||||
}
|
||||
if (this.props.onDownArrow && this.props.onDownArrow()) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue