Skip to content

Commit 57fe328

Browse files
committed
fix selection logic
1 parent 13bec04 commit 57fe328

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/OptionList.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ const OptionList: React.RefForwardingComponent<
142142

143143
// ========================= Keyboard =========================
144144
React.useImperativeHandle(ref, () => ({
145-
onKeyDown: ({ which }) => {
145+
onKeyDown: event => {
146+
const { which } = event;
146147
switch (which) {
147148
// >>> Arrow keys
148149
case KeyCode.UP:
@@ -173,6 +174,10 @@ const OptionList: React.RefForwardingComponent<
173174
onSelectValue(null);
174175
}
175176

177+
if (open) {
178+
event.preventDefault();
179+
}
180+
176181
break;
177182
}
178183

0 commit comments

Comments
 (0)