@@ -124,10 +124,26 @@ const OptionList: React.ForwardRefRenderFunction<RefOptionListProps, {}> = (_, r
124
124
125
125
// https://github.com/ant-design/ant-design/issues/34975
126
126
const isSelected = React . useCallback (
127
- ( value : RawValueType ) => rawValues . has ( value ) && mode !== 'combobox' ,
127
+ ( value : RawValueType ) => {
128
+ if ( mode === 'combobox' ) {
129
+ return false ;
130
+ }
131
+ return rawValues . has ( value ) ;
132
+ } ,
128
133
[ mode , [ ...rawValues ] . toString ( ) , rawValues . size ] ,
129
134
) ;
130
135
136
+ // https://github.com/ant-design/ant-design/issues/48036
137
+ const isAriaSelected = React . useCallback (
138
+ ( value : RawValueType ) => {
139
+ if ( mode === 'combobox' ) {
140
+ return String ( value ) . toLowerCase ( ) === searchValue . toLowerCase ( ) ;
141
+ }
142
+ return rawValues . has ( value ) ;
143
+ } ,
144
+ [ mode , searchValue , [ ...rawValues ] . toString ( ) , rawValues . size ] ,
145
+ ) ;
146
+
131
147
// Auto scroll to item position in single mode
132
148
useEffect ( ( ) => {
133
149
/**
@@ -275,7 +291,7 @@ const OptionList: React.ForwardRefRenderFunction<RefOptionListProps, {}> = (_, r
275
291
{ ...attrs }
276
292
key = { index }
277
293
{ ...getItemAriaProps ( item , index ) }
278
- aria-selected = { isSelected ( value ) }
294
+ aria-selected = { isAriaSelected ( value ) }
279
295
>
280
296
{ value }
281
297
</ div >
@@ -360,7 +376,7 @@ const OptionList: React.ForwardRefRenderFunction<RefOptionListProps, {}> = (_, r
360
376
< div
361
377
{ ...pickAttrs ( passedProps ) }
362
378
{ ...( ! virtual ? getItemAriaProps ( item , itemIndex ) : { } ) }
363
- aria-selected = { selected }
379
+ aria-selected = { isAriaSelected ( value ) }
364
380
className = { optionClassName }
365
381
title = { optionTitle }
366
382
onMouseMove = { ( ) => {
0 commit comments