Dropdown follow wai-aria practices for expanding on arrow keys (#7277)
This commit is contained in:
@@ -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:
|
||||||
this.setState({
|
if (this.state.expanded) {
|
||||||
highlightedOption: this.nextOption(this.state.highlightedOption),
|
this.setState({
|
||||||
});
|
highlightedOption: this.nextOption(this.state.highlightedOption),
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.setState({ expanded: true });
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Key.ARROW_UP:
|
case Key.ARROW_UP:
|
||||||
this.setState({
|
if (this.state.expanded) {
|
||||||
highlightedOption: this.prevOption(this.state.highlightedOption),
|
this.setState({
|
||||||
});
|
highlightedOption: this.prevOption(this.state.highlightedOption),
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.setState({ expanded: true });
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
handled = false;
|
handled = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user