You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-08 21:42:24 +03:00
fix: allow up/down normally for no completions
Autocomplete current eats up up/down key events by unconditionally returning true for onUpArrow and onDownArrow. Instead, only do that if there are completions actually visible.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user