mirror of
https://github.com/element-hq/element-web
synced 2024-11-24 02:05:45 +03:00
Dropdown follow wai-aria practices for expanding on arrow keys (#7277)
This commit is contained in:
parent
ca6feaad89
commit
7dfdb06627
1 changed files with 14 additions and 6 deletions
|
@ -222,14 +222,22 @@ export default class Dropdown extends React.Component<IProps, IState> {
|
||||||
this.close();
|
this.close();
|
||||||
break;
|
break;
|
||||||
case Key.ARROW_DOWN:
|
case Key.ARROW_DOWN:
|
||||||
|
if (this.state.expanded) {
|
||||||
this.setState({
|
this.setState({
|
||||||
highlightedOption: this.nextOption(this.state.highlightedOption),
|
highlightedOption: this.nextOption(this.state.highlightedOption),
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
this.setState({ expanded: true });
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Key.ARROW_UP:
|
case Key.ARROW_UP:
|
||||||
|
if (this.state.expanded) {
|
||||||
this.setState({
|
this.setState({
|
||||||
highlightedOption: this.prevOption(this.state.highlightedOption),
|
highlightedOption: this.prevOption(this.state.highlightedOption),
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
this.setState({ expanded: true });
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
handled = false;
|
handled = false;
|
||||||
|
|
Loading…
Reference in a new issue