Skip to content

Commit 4830128

Browse files
author
Hector Arce De Las Heras
committed
Add accessibility props to DropdownSelected component
This commit enhances the DropdownSelected component by adding `aria-expanded` and `aria-haspopup` props. The `aria-expanded` prop indicates whether the dropdown is currently open, and the `aria-haspopup` prop indicates that the dropdown has a popup context menu or sub-level menu. These improvements enhance the accessibility of the DropdownSelected component, making it more user-friendly for individuals using assistive technologies.
1 parent d29420d commit 4830128

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/components/dropdownSelected/dropdownSelectedStandAlone.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { useMemo } from 'react';
22

33
import { keyDownMove, keyUpMove } from '@/components/listOptions/utils';
44
import { useId } from '@/hooks/useId/useId';
5+
import { ROLES } from '@/types';
56

67
import { ButtonType } from '../button';
78
import { ElementOrIcon } from '../elementOrIcon';
@@ -76,6 +77,8 @@ const DropdownSelectedStandAloneComponent = (props: IDropdownSelectedStandAlone)
7677
ref={props.buttonOrLinkRef}
7778
$rotate={props.open}
7879
aria-controls={ariaControls}
80+
aria-expanded={props.open}
81+
aria-haspopup={ROLES.LISTBOX}
7982
as={props.component}
8083
styles={props.styles}
8184
target={!props.url ? undefined : props.urlTarget}

0 commit comments

Comments
 (0)