Skip to content

Commit b52e075

Browse files
authored
feat(DropdownNew): enhance accessibility attributes for dropdown states (#3110)
1 parent 20c30f9 commit b52e075

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

packages/core/src/components/DropdownNew/components/Trigger/MultiSelectTrigger.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const MultiSelectTrigger = () => {
1717
multiline,
1818
disabled,
1919
readOnly,
20+
error,
2021
size,
2122
searchable,
2223
getToggleButtonProps,
@@ -33,7 +34,10 @@ const MultiSelectTrigger = () => {
3334
? getToggleButtonProps({
3435
"aria-haspopup": "dialog",
3536
"aria-labelledby": label ? getLabelProps().id : undefined,
36-
"aria-label": ariaLabel || (label ? undefined : getLabelProps()?.id)
37+
"aria-label": ariaLabel || (label ? undefined : getLabelProps()?.id),
38+
"aria-disabled": disabled ? "true" : undefined,
39+
"aria-invalid": error ? "true" : undefined,
40+
"aria-readonly": readOnly ? "true" : undefined
3741
})
3842
: {})}
3943
>

packages/core/src/components/DropdownNew/components/Trigger/SingleSelectTrigger.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ const SingleSelectTrigger = () => {
1818
isFocused,
1919
getToggleButtonProps,
2020
disabled,
21+
readOnly,
22+
error,
2123
label,
2224
getLabelProps,
2325
ariaLabel
@@ -31,7 +33,10 @@ const SingleSelectTrigger = () => {
3133
? getToggleButtonProps({
3234
"aria-haspopup": "dialog",
3335
"aria-labelledby": label ? getLabelProps().id : undefined,
34-
"aria-label": ariaLabel || (label ? undefined : getLabelProps()?.id)
36+
"aria-label": ariaLabel || (label ? undefined : getLabelProps()?.id),
37+
"aria-disabled": disabled ? "true" : undefined,
38+
"aria-invalid": error ? "true" : undefined,
39+
"aria-readonly": readOnly ? "true" : undefined
3540
})
3641
: {})}
3742
>

0 commit comments

Comments
 (0)