@@ -57,6 +57,8 @@ export type ValueType = any;
5757export interface InputPickerProps < T = ValueType >
5858 extends FormControlPickerProps < T , InputPickerLocale , InputItemDataType > ,
5959 SelectProps < T > {
60+ tabIndex ?: number ;
61+
6062 multi ?: boolean ;
6163
6264 /** Settings can create new options */
@@ -126,6 +128,7 @@ const InputPicker: PickerComponent<InputPickerProps> = React.forwardRef(
126128 labelKey,
127129 listProps,
128130 id,
131+ tabIndex,
129132 sort,
130133 renderMenu,
131134 renderExtraFooter,
@@ -164,8 +167,6 @@ const InputPicker: PickerComponent<InputPickerProps> = React.forwardRef(
164167 const [ maxWidth , setMaxWidth ] = useState ( 100 ) ;
165168 const [ newData , setNewData ] = useState ( [ ] ) ;
166169 const [ uncontrolledOpen , setOpen ] = useState ( defaultOpen ) ;
167- // Use component active state to support keyboard events.
168- const [ active , setActive ] = useState ( false ) ;
169170 const open = isUndefined ( controlledOpen ) ? uncontrolledOpen : controlledOpen ;
170171
171172 const getAllData = useCallback ( ( ) => [ ] . concat ( uncontrolledData , newData ) , [
@@ -516,11 +517,12 @@ const InputPicker: PickerComponent<InputPickerProps> = React.forwardRef(
516517 } , [ setFocusItemValue , setSearchKeyword , onClose , value , multi ] ) ;
517518
518519 const handleFocus = useCallback ( ( ) => {
519- setActive ( true ) ;
520+ setOpen ( true ) ;
521+ triggerRef . current ?. open ( ) ;
520522 } , [ ] ) ;
521523
522524 const handleBlur = useCallback ( ( ) => {
523- setActive ( false ) ;
525+ setOpen ( false ) ;
524526 } , [ ] ) ;
525527
526528 const handleEnter = useCallback ( ( ) => {
@@ -675,7 +677,7 @@ const InputPicker: PickerComponent<InputPickerProps> = React.forwardRef(
675677
676678 const classes = merge ( pickerClasses , {
677679 [ prefix `tag` ] : multi ,
678- [ prefix `focused` ] : open || active
680+ [ prefix `focused` ] : open
679681 } ) ;
680682 const searching = ! ! searchKeyword && open ;
681683 const displaySearchInput = searchable && ! disabled ;
@@ -721,7 +723,7 @@ const InputPicker: PickerComponent<InputPickerProps> = React.forwardRef(
721723 onClean = { handleClean }
722724 cleanable = { cleanable && ! disabled }
723725 hasValue = { hasValue }
724- active = { active }
726+ active = { open }
725727 disabled = { disabled }
726728 placement = { placement }
727729 inputValue = { value }
@@ -733,6 +735,7 @@ const InputPicker: PickerComponent<InputPickerProps> = React.forwardRef(
733735 { displaySearchInput && (
734736 < InputSearch
735737 { ...inputProps }
738+ tabIndex = { tabIndex }
736739 readOnly = { readOnly }
737740 onBlur = { createChainedFunction ( handleBlur , onBlur ) }
738741 onFocus = { createChainedFunction ( handleFocus , onFocus ) }
0 commit comments