@@ -95,7 +95,7 @@ const useStyles = createStyles(({ css, token }) => ({
9595export interface BAISelectProps <
9696 ValueType = any ,
9797 OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType ,
98- > extends Omit < SelectProps < ValueType , OptionType > , 'onSearch' > {
98+ > extends Omit < SelectProps < ValueType , OptionType > , 'onSearch' | 'role' > {
9999 ref ?: React . RefObject < GetRef < typeof Select < ValueType , OptionType > > | null > ;
100100 ghost ?: boolean ;
101101 autoSelectOption ?:
@@ -108,6 +108,11 @@ export interface BAISelectProps<
108108 footer ?: React . ReactNode ;
109109 endReached ?: ( ) => void ; // New prop for endReached
110110 searchAction ?: ( value : string ) => Promise < void > ;
111+ // antd v6 made `role` required on SelectProps. We default it to
112+ // `'combobox'` here because every BAISelect in this project enables
113+ // search by default; callers can still override (e.g. `role="listbox"`
114+ // for non-searchable variants).
115+ role ?: SelectProps < ValueType , OptionType > [ 'role' ] ;
111116}
112117
113118function BAISelect <
@@ -123,6 +128,7 @@ function BAISelect<
123128 footer,
124129 endReached, // Destructure the new prop
125130 searchAction,
131+ role = 'combobox' ,
126132 ...selectProps
127133} : BAISelectProps < ValueType , OptionType > ) : React . ReactElement {
128134 const { value, options, onChange } = selectProps ;
@@ -196,6 +202,7 @@ function BAISelect<
196202 < Tooltip title = { tooltip } >
197203 < Select < ValueType , OptionType >
198204 { ...selectProps }
205+ role = { role }
199206 loading = { isPending || selectProps . loading }
200207 showSearch = { composedShowSearch }
201208 ref = { ref }
0 commit comments