@@ -14,7 +14,7 @@ import classNames from 'classnames';
14
14
import useMergedState from 'rc-util/lib/hooks/useMergedState' ;
15
15
import Selector , { RefSelectorProps } from './Selector' ;
16
16
import SelectTrigger , { RefTriggerProps } from './SelectTrigger' ;
17
- import { RenderNode , Mode , RenderDOMFunc } from './interface' ;
17
+ import { RenderNode , Mode , RenderDOMFunc , OnActiveValue } from './interface' ;
18
18
import {
19
19
GetLabeledValue ,
20
20
FilterOptions ,
@@ -187,11 +187,10 @@ export interface GenerateConfig<OptionsType extends object[]> {
187
187
/** Convert single raw value into { label, value } format. Will be called by each value */
188
188
getLabeledValue : GetLabeledValue < FlattenOptionsType < OptionsType > > ;
189
189
filterOptions : FilterOptions < OptionsType > ;
190
- findValueOption :
191
- | ( // Need still support legacy ts api
192
- ( values : RawValueType [ ] , options : FlattenOptionsType < OptionsType > ) => OptionsType )
193
- | ( // New API add prevValueOptions support
194
- (
190
+ findValueOption : // Need still support legacy ts api
191
+ | ( ( values : RawValueType [ ] , options : FlattenOptionsType < OptionsType > ) => OptionsType )
192
+ // New API add prevValueOptions support
193
+ | ( (
195
194
values : RawValueType [ ] ,
196
195
options : FlattenOptionsType < OptionsType > ,
197
196
info ?: { prevValueOptions ?: OptionsType [ ] } ,
@@ -874,10 +873,10 @@ export default function generateSelector<
874
873
const mergedDefaultActiveFirstOption =
875
874
defaultActiveFirstOption !== undefined ? defaultActiveFirstOption : mode !== 'combobox' ;
876
875
877
- const onActiveValue = ( active : RawValueType , index : number ) => {
876
+ const onActiveValue : OnActiveValue = ( active , index , { source = 'keyboard' } = { } ) => {
878
877
setAccessibilityIndex ( index ) ;
879
878
880
- if ( backfill && mode === 'combobox' && active !== null ) {
879
+ if ( backfill && mode === 'combobox' && active !== null && source === 'keyboard' ) {
881
880
setActiveValue ( String ( active ) ) ;
882
881
}
883
882
} ;
0 commit comments