Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into t3chguy/a11y/composer-list-autocomplete

 Conflicts:
	src/components/structures/LoggedInView.tsx
	src/components/views/rooms/BasicMessageComposer.tsx
	src/editor/autocomplete.ts
This commit is contained in:
Michael Telatynski 2021-05-11 10:59:22 +01:00
commit 60d3da2441
717 changed files with 34517 additions and 8522 deletions

View file

@ -68,9 +68,11 @@ export default class AutocompleteWrapperModel {
this.updateCallback({close: true});
}
public async onTab(e: KeyboardEvent) {
/**
* If there is no current autocompletion, start one and move to the first selection.
*/
public async startSelection() {
const acComponent = this.getAutocompleterComponent();
if (acComponent.countCompletions() === 0) {
// Force completions to show for the text currently entered
await acComponent.forceComplete();
@ -80,11 +82,11 @@ export default class AutocompleteWrapperModel {
}
}
public onUpArrow(e: KeyboardEvent) {
public selectPreviousSelection() {
this.getAutocompleterComponent().moveSelection(-1);
}
public onDownArrow(e: KeyboardEvent) {
public selectNextSelection() {
this.getAutocompleterComponent().moveSelection(+1);
}
@ -124,10 +126,8 @@ export default class AutocompleteWrapperModel {
case "at-room":
return [this.partCreator.atRoomPill(completionId), this.partCreator.plain(completion.suffix)];
case "user":
// not using suffix here, because we also need to calculate
// the suffix when clicking a display name to insert a mention,
// which happens in createMentionParts
return this.partCreator.createMentionParts(this.partIndex, text, completionId);
// Insert suffix only if the pill is the part with index 0 - we are at the start of the composer
return this.partCreator.createMentionParts(this.partIndex === 0, text, completionId);
case "command":
// command needs special handling for auto complete, but also renders as plain texts
return [(this.partCreator as CommandPartCreator).command(text)];