11import IconMode from '@ui5/webcomponents/dist/types/IconMode.js' ;
2+ import ListAccessibleRole from '@ui5/webcomponents/dist/types/ListAccessibleRole.js' ;
23import ListItemType from '@ui5/webcomponents/dist/types/ListItemType.js' ;
34import PopoverHorizontalAlign from '@ui5/webcomponents/dist/types/PopoverHorizontalAlign.js' ;
45import PopoverPlacement from '@ui5/webcomponents/dist/types/PopoverPlacement.js' ;
6+ import PopupAccessibleRole from '@ui5/webcomponents/dist/types/PopupAccessibleRole.js' ;
57import iconDecline from '@ui5/webcomponents-icons/dist/decline.js' ;
68import iconFilter from '@ui5/webcomponents-icons/dist/filter.js' ;
79import iconGroup from '@ui5/webcomponents-icons/dist/group-2.js' ;
810import iconSortAscending from '@ui5/webcomponents-icons/dist/sort-ascending.js' ;
911import iconSortDescending from '@ui5/webcomponents-icons/dist/sort-descending.js' ;
10- import { enrichEventWithDetails , useI18nBundle } from '@ui5/webcomponents-react-base' ;
12+ import { useI18nBundle } from '@ui5/webcomponents-react-base/hooks' ;
13+ import type { Ui5DomRef } from '@ui5/webcomponents-react-base/internal/types' ;
14+ import { enrichEventWithDetails } from '@ui5/webcomponents-react-base/internal/utils' ;
1115import { useEffect , useId , useRef } from 'react' ;
1216import { FlexBoxAlignItems } from '../../../../enums/FlexBoxAlignItems.js' ;
1317import { TextAlign } from '../../../../enums/TextAlign.js' ;
@@ -22,7 +26,9 @@ import {
2226import { stopPropagation } from '../../../../internal/stopPropagation.js' ;
2327import { getUi5TagWithSuffix } from '../../../../internal/utils.js' ;
2428import { Icon } from '../../../../webComponents/Icon/index.js' ;
29+ import type { ListDomRef } from '../../../../webComponents/List/index.js' ;
2530import { List } from '../../../../webComponents/List/index.js' ;
31+ import type { ListItemCustomPropTypes } from '../../../../webComponents/ListItemCustom/index.js' ;
2632import { ListItemCustom } from '../../../../webComponents/ListItemCustom/index.js' ;
2733import { ListItemStandard } from '../../../../webComponents/ListItemStandard/index.js' ;
2834import type { PopoverDomRef , PopoverPropTypes } from '../../../../webComponents/Popover/index.js' ;
@@ -44,7 +50,7 @@ export const ColumnHeaderModal = (instance: TableInstanceWithPopoverProps) => {
4450 const showSort = column . canSort ;
4551
4652 const ref = useRef < PopoverDomRef > ( null ) ;
47- const listRef = useRef ( null ) ;
53+ const listRef = useRef < ListDomRef > ( null ) ;
4854
4955 const i18nBundle = useI18nBundle ( '@ui5/webcomponents-react' ) ;
5056
@@ -125,7 +131,7 @@ export const ColumnHeaderModal = (instance: TableInstanceWithPopoverProps) => {
125131 } ;
126132
127133 const onAfterOpen = ( ) => {
128- listRef . current ?. children ?. [ 0 ] ?. focus ( ) ;
134+ void ( listRef . current ?. children ?. [ 0 ] as Ui5DomRef ) ?. focus ( ) ;
129135 } ;
130136
131137 const horizontalAlign = ( ( ) => {
@@ -145,7 +151,7 @@ export const ColumnHeaderModal = (instance: TableInstanceWithPopoverProps) => {
145151 }
146152 } ) ( ) ;
147153
148- const handleCustomLiKeyDown = ( e ) => {
154+ const handleCustomLiKeyDown : ListItemCustomPropTypes [ 'onKeyDown' ] = ( e ) => {
149155 if ( e . key === 'Enter' ) {
150156 setOpen ( false ) ;
151157 }
@@ -181,23 +187,32 @@ export const ColumnHeaderModal = (instance: TableInstanceWithPopoverProps) => {
181187 onClick = { stopPropagation }
182188 onClose = { onAfterClose }
183189 onOpen = { onAfterOpen }
190+ accessibleRole = { PopupAccessibleRole . None }
184191 data-component-name = "ATHeaderPopover"
185192 >
186193 < List
187194 onItemClick = { handleSort }
188195 ref = { listRef }
189196 onKeyDown = { handleListKeyDown }
197+ accessibleRole = { ListAccessibleRole . Menu }
190198 data-component-name = "ATHeaderPopoverList"
191199 >
192200 { isSortedAscending && (
193- < ListItemStandard type = { ListItemType . Active } icon = { iconDecline } data-sort = "clear" text = { clearSortingText } />
201+ < ListItemStandard
202+ type = { ListItemType . Active }
203+ icon = { iconDecline }
204+ data-sort = "clear"
205+ text = { clearSortingText }
206+ accessible-role = "MenuItem"
207+ />
194208 ) }
195209 { showSort && ! isSortedAscending && (
196210 < ListItemStandard
197211 type = { ListItemType . Active }
198212 icon = { iconSortAscending }
199213 data-sort = "asc"
200214 text = { sortAscendingText }
215+ accessible-role = "MenuItem"
201216 />
202217 ) }
203218 { showSort && ! isSortedDescending && (
@@ -206,13 +221,25 @@ export const ColumnHeaderModal = (instance: TableInstanceWithPopoverProps) => {
206221 icon = { iconSortDescending }
207222 data-sort = "desc"
208223 text = { sortDescendingText }
224+ accessible-role = "MenuItem"
209225 />
210226 ) }
211227 { isSortedDescending && (
212- < ListItemStandard type = { ListItemType . Active } icon = { iconDecline } data-sort = "clear" text = { clearSortingText } />
228+ < ListItemStandard
229+ type = { ListItemType . Active }
230+ icon = { iconDecline }
231+ data-sort = "clear"
232+ text = { clearSortingText }
233+ accessible-role = "MenuItem"
234+ />
213235 ) }
214236 { showFilter && (
215- < ListItemCustom type = { ListItemType . Inactive } onKeyDown = { handleCustomLiKeyDown } accessibleName = { filterText } >
237+ < ListItemCustom
238+ type = { ListItemType . Active }
239+ onKeyDown = { handleCustomLiKeyDown }
240+ accessibleName = { filterText }
241+ accessible-role = "MenuItem"
242+ >
216243 < FlexBox alignItems = { FlexBoxAlignItems . Center } >
217244 < Icon name = { iconFilter } className = { classNames . filterIcon } mode = { IconMode . Decorative } />
218245 < Text maxLines = { 1 } className = { classNames . filterText } id = { `${ uniqueId } -filter-text` } >
@@ -231,6 +258,7 @@ export const ColumnHeaderModal = (instance: TableInstanceWithPopoverProps) => {
231258 icon = { iconGroup }
232259 data-sort = { 'group' }
233260 text = { column . isGrouped ? ungroupText : groupText }
261+ accessible-role = "MenuItem"
234262 />
235263 ) }
236264 </ List >
0 commit comments