Skip to content
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

Why does the guidance state that an unlabelled tablist needs an aria label? #3211

Open
mbgower opened this issue Jan 10, 2025 · 10 comments
Open

Comments

@mbgower
Copy link

mbgower commented Jan 10, 2025

On https://www.w3.org/WAI/ARIA/apg/patterns/tabs/ it states:

If the tab list has a visible label, the element with role tablist has aria-labelledby set to a value that refers to the labelling element. Otherwise, the tablist element has a label provided by aria-label.

Teams are interpreting the second sentence to mean every tablist must be named. What is the rationale?

Most tablists are not visually labelled, and they should not need to be programmatically named either. A tab/tablist is a composite element, made up of a tablist, set of tabs, and associated tabpanels. The tablist role provides the context for the interaction, and the active tab element provides a name (and context) for the composite component.

The above quote seems overly prescriptive, and is leading to teams making up arbitrary names for unlabelled tabs, which go undetected during testing and can add as much confusion as benefit.

@JAWS-test
Copy link

According to the ARIA specification (https://w3c.github.io/aria/#tablist), a tablist does not have to be labelled. Therefore, the sentence you quoted should be changed to indicate that the tablist can be labelled with aria-label, but does not have to be

@JAWS-test
Copy link

Duplicate of #2319

@JAWS-test
Copy link

Related: #620

mbgower added a commit to mbgower/aria-practices that referenced this issue Jan 11, 2025
My suggested wording approach, based on w3c#3211
@mbgower
Copy link
Author

mbgower commented Jan 11, 2025

@JAWS-test

According to the ARIA specification (https://w3c.github.io/aria/#tablist), a tablist does not have to be labelled.

How are you deriving that from the spec you cite? I specifically looked there before opening this and did not see anything stating it does not have to be labelled. In fact, when I saw "Name From: author" I thought it was stating the opposite.

I am in full support of your conclusion and recommendation, but I wanted to point out to the caretakers of the spec (and supporting documents) that my scan of the document did not lead me to that conclusion, nor did I find the documents @mcking65 is referring to in one of the issues your referenced, #2319

My take as someone who uses the APG fairly frequently is that the language there should reinforce the intent, so I would definitely advocate that the phrase (and its siblings in other be changed to something like:

Use aria-labelledby if a visible label is present, otherwise aria-label may be used

Note that I have linked to that naming guidance table, to improve its discoverability.

The other change I would advocate is that the rating of tablist in that table be changed from "Recommended". Shouldn't it be required when there is a visible label, and discretionary when not? I created a draft PR with one suggested approach, to give you something to iterate on, or reject entirely #3212

@JAWS-test
Copy link

@mbgower

How are you deriving that from the spec you cite?

Quite simple: Elements that need to be labelled have a table row with the content: "Accessible Name Required: True"

You can also look at: https://w3c.github.io/aria/#namefromauthor - Elements that need to be labelled have "(name required)"

@mbgower
Copy link
Author

mbgower commented Jan 12, 2025

Quite simple: Elements that need to be labelled have a table row with the content: "Accessible Name Required: True"

Then I believe that each role should have that row in its table and it should read "False" for the ones where it is not required.

Otherwise those of us without a high degree of familiarity with the spec who look at a role's characteristics table in isolation are left with the impression via the "Name from" row that name is required (especially given the language in the APG).

@mcking65
Copy link
Contributor

mcking65 commented Jan 14, 2025

Related #3212

@mbgower

Thank you for raising the issue and submitting a PR. The naming should certainly be optional, and the text of the pattern does not accurately convey that.

A tablist is frequently similar in function to a list of links that benefit from having a named nav wrapper. However, I don't think we would want to suggest adding anav wrapper around a tablist as that could encourage adding landmark regions in situations where doing so could degrade the overall landmark experience.

Sometimes the context of a tablist is narrow and easily determined by a screen reader user, e.g., a set of tabs contained inside of a named dialog. In those cases, it is less likely that providing a tablist name would improve the screen reader experience.

It seems to me that this is a situation where it is not clear whether naming should be recommended or discretionary.

In my experience, most tablists that should be named also have a visual title that provides excellent context. Often they are not juxtaposed, so aria-labelledby is extremely valuable. This is a point in favor of naming being recommended.

In the cases where there is no visible text that could serve as a name, my experience is pretty mixed. It often depends on how the tabs themselves are named.

One resolution path could be to specify the necessity as recommended and then include guidance that naming is unnecessary when both 1) there is no visible text that can serve as a useful name , and 2) individual tab names are sufficiently meaningful.

To resolve this issue, we would need a single PR that updates both the naming guidance table and the pattern. It does not appear there is any need to update the examples.

@JAWS-test
Copy link

@mbgower

Then I believe that each role should have that row in its table and it should read "False" for the ones where it is not required.

Yes, but this must be reported here: https://github.com/w3c/aria/issues

@mbgower
Copy link
Author

mbgower commented Jan 14, 2025

@mcking65

To resolve this issue, we would need a single PR that updates both the naming guidance table and the pattern. It does not appear there is any need to update the examples.

I've added the pattern change to the PR I made.

@mbgower
Copy link
Author

mbgower commented Jan 14, 2025

@JAWS-test

Yes, but this must be reported here: https://github.com/w3c/aria/issues

Thanks, I've opened w3c/aria#2411

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants