File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
src/components/fields/ComboBox Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @cube-dev/ui-kit ' : patch
3+ ---
4+
5+ Fix ComboBox behavior on choosing option via Enter press.
Original file line number Diff line number Diff line change @@ -336,7 +336,13 @@ export const ComboBox = forwardRef(function ComboBox<T extends object>(
336336 if ( e . key === 'Enter' ) {
337337 if ( ! props . allowsCustomValue ) {
338338 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+
339344 const option = [ ...state . collection ] [ 0 ] ?. key ;
345+
340346 if ( option && selectedKey !== option ) {
341347 props . onSelectionChange ?.( option ) ;
342348
You can’t perform that action at this time.
0 commit comments