-
Notifications
You must be signed in to change notification settings - Fork 779
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
Call out missing accessible name on various ARIA roles #2421
Comments
Thanks for the proposal. It's up to @WilcoFiers if we want the new rule, but I'll add some information on how we would write it: // rules/aria-required-name.json
{
"id": "aria-required-name",
"selector": "[role]",
"metadata": {
"description": "Ensures elements with ARIA roles that require an accessible name have one",
"help": "Required accessible name must be present"
},
"all": [],
"any": ["aria-required-name"],
"none": []
} The check would then check if the role requires a name (which we would need to add to the standards object, something like |
Tackling this was proposed in one of the oldest still open issues: #470 I think this is a good idea. It goes a little beyond role=tree. We need rules for all of the "requires accessible name" role we don't have one for already, and probably group them into a few rules. |
Naively I would just collect all the roles that aren't currently checked and put them into a new rule. That way we automatically avoid redundant violations. It may help to further divide them by the technique that names them so that it's easier to give actionable advise. I'll draft a list of all roles that require an accessible name but do not trigger any violation and then it might be obvious how/if we group those missing violations. |
Using https://9p5yw.csb.app/ the following roles are not flagged even though they require an accessible name but have none:
If you can adjust the advise based on the role it seems like grouping all these into a single rule makes the most sense. Otherwise we should probably group them by their naming technique because, for example, |
This is something we were thinking to do for axe-core 4.1. Much appreciate the PR. I've gone through the existing ARIA roles, and think we can organise them in the following way: aria-toggle-field-name - tag: sc412
aria-input-field-name - tag: sc412 (unchanged)
role-img-alt - tag: sc111
aria-command-name (NEW) - tag: sc412
aria-structure-name (NEW) - tag: best-practiceCANCELLED: Requiring all these to have an accessible name is a little questionable. While for many it can help, it is questionable if this is the case for all of them.
aria-dialog-name (NEW) - tag: best-practice
aria-table-header-name (NEW) - tag: 1.3.1Needs review only:
aria-item-name (NEW) - tag: best-practice
aria-meter-name (NEW) - tag: sc111
aria-progressbar-name (NEW) - tag: sc111
aria-tooltip-name (NEW) - tag: sc412
|
Is meant to be And considering
you prefer each rule in a separate PR or each role in a separate PR? |
Hey @eps1lon, apologies for the slow response.
Yes, you're right, my bad.
Each new rule should be in a new PR. |
@WilcoFiers If you want to group the roles by their "concept" then I don't know how you want to give actionable advise with the current json format of the rules. For example It's also not clear how #2421 (comment) fits into #2431 (review) I lean more towards #2431 (review) since this focuses on the action that should be taken. I see little value in telling the user that a |
Leaving off marque for now. I don't quite see why it requires an accessible name. Opened an issue with the ARIA WG for it: w3c/aria#1339 |
@WilcoFiers Could you clarify whether you still want to group the rules by concept and what kind of message you would display in |
@eps1lon Thanks for checking back in. You are right, heading doesn't work in aria-structure-map because it is named from content, so it's probably best just left where it is. We'll leave that out in the empty-headings rule. The rest of those roles aren't named from content, so they can be grouped together. Updating the above comments so it's all up to date again. |
I'd like to try tackling |
Alrighty, update. I've discussed these new rules internally, and gained some new perspective on things. Here's what has been decided:
That leaves a few more changes, see the top post of this issue. |
Important: @jlin95 @eps1lon If you'd like to contribute to this issue, we will need your pull request completed by Friday at the latest. Feature freeze for axe-core 4.1 happens on Monday November 2nd. I want to get these rules in by then. Whatever hasn't been completed by Monday morning, @straker and I will finish up that day. |
@WilcoFiers Do you know why these names are required per ARIA then? If there are legitimate scenarios where a name doesn't make sense then ARIA requiring them might degrade user experience if devs simply follow ARIA (which is perfectly fine since not everybody can be an expert). But it feels odd that ARIA would require them unless they aren't aware of legitimate use cases.
My original issue was with |
Expectation:
<div role="tree" />
triggers a violation because it does not have an accessible name. Example: https://2m3yw.csb.app/Actual: No violation reported
Motivation:
role="tree"
requires an accessible name in ARIA 1.1 and 1.2.<button />
).axe-core should probably report any element without a name that has a role that requires an accessible name.
Rules to add:
Taken from #2421 (comment)
aria-structure-name (NEW) - tag: best-practice (feat: Add aria-structure-name rule #2431)aria-table-header-name (NEW) - tag: 1.3.1aria-input-field-name: add "radiogroup" - skipped, not sure if this is rightaria-marquee-name - not happening because of Why does marquee require an accessible name? w3c/aria#1339The text was updated successfully, but these errors were encountered: