A11y fix role-has-required-aria-props (#7455)

* remove jsx a11y direct use in eslintrc

Signed-off-by: Kerry Archibald <kerrya@element.io>

* remove debug

Signed-off-by: Kerry Archibald <kerrya@element.io>

* split aria-selected out from restProps in Autocomplete

Signed-off-by: Kerry Archibald <kerrya@element.io>

* update Dropdown to aria 1.1 aria-owns -> aria-controls

Signed-off-by: Kerry Archibald <kerrya@element.io>

* unignore jsx-a11y/role-has-required-aria-props rule

Signed-off-by: Kerry Archibald <kerrya@element.io>

* remove debug

Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
Kerry 2022-01-04 09:46:21 +01:00 committed by GitHub
parent 846fbfa2a0
commit aaf14aacd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 5 deletions

View file

@ -313,7 +313,7 @@ export default class Dropdown extends React.Component<IProps, IState> {
);
});
if (options.length === 0) {
return [<div key="0" className="mx_Dropdown_option" role="option">
return [<div key="0" className="mx_Dropdown_option" role="option" aria-selected={false}>
{ _t("No results") }
</div>];
}
@ -331,6 +331,7 @@ export default class Dropdown extends React.Component<IProps, IState> {
if (this.props.searchEnabled) {
currentValue = (
<input
id={`${this.props.id}_input`}
type="text"
autoFocus={true}
className="mx_Dropdown_option"
@ -339,7 +340,8 @@ export default class Dropdown extends React.Component<IProps, IState> {
role="combobox"
aria-autocomplete="list"
aria-activedescendant={`${this.props.id}__${this.state.highlightedOption}`}
aria-owns={`${this.props.id}_listbox`}
aria-expanded={this.state.expanded}
aria-controls={`${this.props.id}_listbox`}
aria-disabled={this.props.disabled}
aria-label={this.props.label}
onKeyDown={this.onKeyDown}
@ -382,6 +384,7 @@ export default class Dropdown extends React.Component<IProps, IState> {
inputRef={this.buttonRef}
aria-label={this.props.label}
aria-describedby={`${this.props.id}_value`}
aria-owns={`${this.props.id}_input`}
onKeyDown={this.onKeyDown}
>
{ currentValue }