Skip to content

Commit e88d02d

Browse files
fix: enable spacebar to be typed in opened mode
1 parent 2cc7ab3 commit e88d02d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/BaseSelect/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,6 @@ const BaseSelect = React.forwardRef<BaseSelectRef, BaseSelectProps>((props, ref)
468468
const isEnterKey = key === 'Enter';
469469
const isSpaceKey = key === ' ';
470470

471-
// Enter or Space opens dropdown (ARIA combobox: spacebar should open)
472471
if (isEnterKey || isSpaceKey) {
473472
// Do not submit form when type in the input; prevent Space from scrolling page
474473
const isCombobox = mode === 'combobox';
@@ -479,6 +478,10 @@ const BaseSelect = React.forwardRef<BaseSelectRef, BaseSelectProps>((props, ref)
479478

480479
// We only manage open state here, close logic should handle by list component
481480
if (!mergedOpen) {
481+
// Do not submit form when type in the input
482+
if (mode !== 'combobox') {
483+
event.preventDefault();
484+
}
482485
triggerOpen(true);
483486
}
484487
}

0 commit comments

Comments
 (0)