Fix lack of screen reader indication when triggering auto complete (#10664)

This commit is contained in:
Michael Telatynski 2023-04-21 10:49:05 +01:00 committed by GitHub
parent be5928cb64
commit fdfe800b2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -798,7 +798,7 @@ export default class BasicMessageEditor extends React.Component<IProps, IState>
}; };
const { completionIndex } = this.state; const { completionIndex } = this.state;
const hasAutocomplete = Boolean(this.state.autoComplete); const hasAutocomplete = !!this.state.autoComplete;
let activeDescendant: string | undefined; let activeDescendant: string | undefined;
if (hasAutocomplete && completionIndex! >= 0) { if (hasAutocomplete && completionIndex! >= 0) {
activeDescendant = generateCompletionDomId(completionIndex!); activeDescendant = generateCompletionDomId(completionIndex!);
@ -828,7 +828,7 @@ export default class BasicMessageEditor extends React.Component<IProps, IState>
aria-multiline="true" aria-multiline="true"
aria-autocomplete="list" aria-autocomplete="list"
aria-haspopup="listbox" aria-haspopup="listbox"
aria-expanded={hasAutocomplete ? true : undefined} aria-expanded={hasAutocomplete ? !this.autocompleteRef.current?.state.hide : undefined}
aria-owns={hasAutocomplete ? "mx_Autocomplete" : undefined} aria-owns={hasAutocomplete ? "mx_Autocomplete" : undefined}
aria-activedescendant={activeDescendant} aria-activedescendant={activeDescendant}
dir="auto" dir="auto"