We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1ba6ea5 commit 7250112Copy full SHA for 7250112
2 files changed
.changeset/big-beers-wash.md
@@ -0,0 +1,5 @@
1
+---
2
+'@cube-dev/ui-kit': patch
3
4
+
5
+Fix ComboBox behavior on choosing option via Enter press.
src/components/fields/ComboBox/ComboBox.tsx
@@ -336,7 +336,13 @@ export const ComboBox = forwardRef(function ComboBox<T extends object>(
336
if (e.key === 'Enter') {
337
if (!props.allowsCustomValue) {
338
if (state.isOpen) {
339
+ // If there is a selected option then do nothing. It will be selected on Enter anyway.
340
+ if (listBoxRef.current?.querySelector('li[aria-selected="true"]')) {
341
+ return;
342
+ }
343
344
const option = [...state.collection][0]?.key;
345
346
if (option && selectedKey !== option) {
347
props.onSelectionChange?.(option);
348
0 commit comments