-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WNMGDS-2694] Audit ARIA on generic roles #2978
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,6 +139,9 @@ export const ChoiceList: React.FC<ChoiceListProps> = (props: ChoiceListProps) => | |
}); | ||
|
||
return ( | ||
// 🥑 | ||
// https://www.w3.org/TR/wai-aria-1.2/#group | ||
// - "aria-invalid (state) (deprecated on this role in ARIA 1.2)" | ||
<fieldset | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO: If choice is |
||
aria-invalid={invalid} | ||
aria-describedby={describeField({ ...props, hintId, errorId })} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,6 +123,11 @@ export const Dialog = (props: DialogProps) => { | |
|
||
useBodyScrollPrevention(modalProps.isOpen ?? true); | ||
|
||
// 🥑 | ||
// Is `tabIndex` necessary here? It's not clear why it's being set to -1. | ||
// It's also not clear why the `role` attribute is being set to `document`. | ||
// Should this allow for more flexible heading tags? Locked into `h1` for now. | ||
// Can we remove `role="main"` from the `main` element? | ||
return ( | ||
<NativeDialog | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO:
I don't believe the Bootstrap issue exists on native dialog elements, so I don't believe the |
||
className={dialogClassNames} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,9 @@ export const Drawer = (props: DrawerProps) => { | |
|
||
const Heading = `h${props.headingLevel}` as const; | ||
|
||
// 🥑 | ||
// Why is `tabIndex` needed here? | ||
// `aria-labelledby` not allowed on `role="generic"` element | ||
return ( | ||
<NativeDialog | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO:
|
||
className={classNames(props.className, 'ds-c-drawer')} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -265,6 +265,10 @@ export const Dropdown: React.FC<DropdownProps> = (props: DropdownProps) => { | |
ref: mergeRefs([triggerRef, inputRef, useAutofocus<HTMLButtonElement>(props.autoFocus)]), | ||
'aria-controls': menuId, | ||
'aria-labelledby': `${buttonContentId} ${labelProps.id}`, | ||
|
||
// 🥑 | ||
// https://www.w3.org/TR/wai-aria-1.2/#button | ||
// - "aria-invalid (state) (deprecated on this role in ARIA 1.2)" | ||
'aria-invalid': invalid, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO: Investigate if |
||
'aria-describedby': describeField({ ...props, hintId, errorId }), | ||
// TODO: Someday we may want to add this `combobox` role back to the button, but right | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,6 +139,10 @@ export const MonthPicker = (props: MonthPickerProps) => { | |
const { hintId, hintElement } = useHint({ ...props, id }); | ||
const labelProps = useLabelProps({ ...props, id }); | ||
|
||
// 🥑 | ||
// https://www.w3.org/TR/wai--1.2/#group | ||
// - "aria-invalid (state) (deprecated on this role in ARIA 1.2)" | ||
|
||
return ( | ||
<fieldset | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO: Add |
||
aria-invalid={invalid} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,9 @@ export const Tab = forwardRef((props: TabProps, ref: any) => { | |
{props.children} | ||
</a> | ||
) : ( | ||
// 🥑 | ||
// https://www.w3.org/TR/wai-aria-1.2/#generic | ||
// - "aria-disabled (state) (deprecated on this role in ARIA 1.2)" | ||
<span aria-disabled="true" {...sharedTabProps}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't realize the |
||
{props.children} | ||
</span> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,9 @@ export const TabPanel = (props: TabPanelProps) => { | |
const classes = classnames('ds-c-tabs__panel', props.className); | ||
|
||
return ( | ||
// 🥑 | ||
// https://www.w3.org/TR/wai-aria-1.2/#tabpanel | ||
// - "aria-disabled (state) (deprecated on this role in ARIA 1.2)" | ||
<div | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO: Explore purpose of disabled Tabs. It's recommended not to disable interactive elements as it can confuse users.
|
||
aria-labelledby={props.tabId} | ||
aria-hidden={!props.selected} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Remove
aria-selected
attr as false is implied by its role.