Skip to content

Commit 5364c25

Browse files
will cohenafc163
will cohen
authored andcommitted
Allow popup list items to be selected with the keyboard
1 parent 28755db commit 5364c25

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Select.jsx

+11-1
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,18 @@ class Select extends Component {
6767
: () => {
6868
this.onSelect(item.value);
6969
};
70+
const onKeyDown = e => e.keyCode === 13 && onClick();
71+
7072
return (
71-
<li role="button" onClick={onClick} className={cls} key={index} disabled={item.disabled}>
73+
<li
74+
role="button"
75+
onClick={onClick}
76+
className={cls}
77+
key={index}
78+
disabled={item.disabled}
79+
tabIndex="0"
80+
onKeyDown={onKeyDown}
81+
>
7282
{item.value}
7383
</li>
7484
);

0 commit comments

Comments
 (0)