@@ -16,7 +16,7 @@ import {AriaComboBoxProps} from '@react-types/combobox';
16
16
import { ariaHideOutside } from '@react-aria/overlays' ;
17
17
import { AriaListBoxOptions , getItemId , listData } from '@react-aria/listbox' ;
18
18
import { BaseEvent , DOMAttributes , KeyboardDelegate , LayoutDelegate , PressEvent , RefObject , RouterOptions , ValidationResult } from '@react-types/shared' ;
19
- import { chain , getActiveElement , getOwnerDocument , isAppleDevice , mergeProps , useLabels , useRouter , useUpdateEffect } from '@react-aria/utils' ;
19
+ import { chain , getActiveElement , getOwnerDocument , isAppleDevice , mergeProps , useEvent , useLabels , useRouter , useUpdateEffect } from '@react-aria/utils' ;
20
20
import { ComboBoxState } from '@react-stately/combobox' ;
21
21
import { dispatchVirtualFocus } from '@react-aria/focus' ;
22
22
import { FocusEvent , InputHTMLAttributes , KeyboardEvent , TouchEvent , useEffect , useMemo , useRef } from 'react' ;
@@ -354,6 +354,10 @@ export function useComboBox<T>(props: AriaComboBoxOptions<T>, state: ComboBoxSta
354
354
}
355
355
} , [ focusedItem ] ) ;
356
356
357
+ useEvent ( listBoxRef , 'react-aria-item-action' , state . isOpen ? ( ) => {
358
+ state . close ( ) ;
359
+ } : undefined ) ;
360
+
357
361
return {
358
362
labelProps,
359
363
buttonProps : {
@@ -383,7 +387,8 @@ export function useComboBox<T>(props: AriaComboBoxOptions<T>, state: ComboBoxSta
383
387
shouldUseVirtualFocus : true ,
384
388
shouldSelectOnPressUp : true ,
385
389
shouldFocusOnHover : true ,
386
- linkBehavior : 'selection' as const
390
+ linkBehavior : 'selection' as const ,
391
+ [ 'UNSTABLE_itemBehavior' ] : 'action'
387
392
} ) ,
388
393
descriptionProps,
389
394
errorMessageProps,
0 commit comments