File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import {
28
28
DropdownRef ,
29
29
} from './Dropdown.types' ;
30
30
import { Menu } from '../Menu' ;
31
+ import { List } from '../List' ;
31
32
import { useMergedState } from '../../hooks/useMergedState' ;
32
33
import { useOnClickOutside } from '../../hooks/useOnClickOutside' ;
33
34
import { usePreviousState } from '../../hooks/usePreviousState' ;
@@ -461,7 +462,9 @@ export const Dropdown: FC<DropdownProps> = React.memo(
461
462
role = { role }
462
463
{ ...overlayProps }
463
464
>
464
- { overlay }
465
+ { React . cloneElement ( overlay , {
466
+ ...( overlay . type === List ? { initialFocus } : { } ) ,
467
+ } ) }
465
468
</ div >
466
469
</ FloatingFocusManager >
467
470
) ;
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ export const List = <T extends any>({
19
19
disableKeys = false ,
20
20
items,
21
21
footer,
22
+ initialFocus = true ,
22
23
layout = 'vertical' ,
23
24
renderAdditionalItem,
24
25
renderItem,
@@ -221,7 +222,6 @@ export const List = <T extends any>({
221
222
ref = { itemRef }
222
223
style = { itemStyle }
223
224
role = "option"
224
- aria-selected = { focusIndex === index ? 'true' : 'false' }
225
225
tabIndex = { focusIndex === index ? 0 : - 1 }
226
226
>
227
227
{ renderItem ( item ) }
Original file line number Diff line number Diff line change @@ -91,4 +91,8 @@ export interface ListProps<T> extends OcBaseProps<HTMLDivElement> {
91
91
* @default false
92
92
*/
93
93
applyCyclicNavigation ?: boolean ;
94
+ /**
95
+ * Initial focus for the list.
96
+ */
97
+ initialFocus ?: boolean ;
94
98
}
You can’t perform that action at this time.
0 commit comments