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

Fix aria-label documentation, removing statement that says it should be used only for interactive items #35465

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

phsantiago
Copy link

@phsantiago phsantiago commented Aug 14, 2024

Description

This change closes #28397, by changing the first paragraph of aria-label page, based on aria-label spec https://w3c.github.io/aria/#aria-label.

Motivation

There are noninteractive elements, such as List, Img, and Meter, that allow aria-label, and it's useful to have this context announced when using assistive technologies.

Additional details

The confusion might have appeared because there are multiple non interactive aria roles, which aria-label is forbidden:

Used in Roles: All elements of the base markup except for the following roles: caption, code, definition, deletion, emphasis, generic, insertion, mark, none, paragraph, strong, subscript, suggestion, superscript, term, time

Related issues and pull requests

#28397

@phsantiago phsantiago requested a review from a team as a code owner August 14, 2024 12:44
@phsantiago phsantiago requested review from scottaohara and removed request for a team August 14, 2024 12:44
@github-actions github-actions bot added Content:Accessibility Accessibility docs size/xs [PR only] 0-5 LoC changed labels Aug 14, 2024
@scottaohara
Copy link
Contributor

Might make sense to explicitly mention aria-label can be used to name an element, so long as the elements implicit or explicit aria role doesn’t prohibit naming.

Listitem, for example being a role that is incorrectly not in the name prohibited category, but will be once the spec updates to correct this. But the other example, role=list or main, article, etc are all nameable roles/elements.

@github-actions github-actions bot added size/s [PR only] 6-50 LoC changed and removed size/xs [PR only] 0-5 LoC changed labels Aug 15, 2024
@@ -7,13 +7,13 @@ spec-urls: https://w3c.github.io/aria/#aria-label

{{AccessibilitySidebar}}

The `aria-label` attribute defines a string value that labels an interactive element.
The `aria-label` attribute defines a string value that can be used to name an element, as long as the element's role does not [prohibit naming](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label#associated_roles).
Copy link
Author

@phsantiago phsantiago Aug 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might it make sense to explicitly mention that aria-label can be used to name an element, so long as the element's implicit or explicit aria role doesn’t prohibit naming.

Pushed a change 83297c7 making it clearer that label should only be used with roles that don't prohibit author naming.

Listitem, for example being a role that is incorrectly not in the name prohibited category, but will be once the spec updates to correct this. But the other example, role=list or main, article, etc are all nameable roles/elements.

Thanks for the context, @scottaohara! I found this nice PR of you on the subject: w3c/aria#2292. Let me know if I could help with anything there, too 🙂

I changed the PR description, including Img and Meter in place of ListItem.

Copy link
Contributor

github-actions bot commented Aug 19, 2024

Preview URLs

(comment last updated: 2024-08-27 04:32:12)

@phsantiago
Copy link
Author

@scottaohara I’ve addressed the feedback provided in the initial review of PR. Could you please take some time to re-review? Thanks in advance 🙂

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@phsantiago
Copy link
Author

Hi @scottaohara, thanks for your previous review. I applied the change you suggested 0ead6ef

Would you mind taking another look when you have a moment? I really appreciate your time and effort in helping get this PR merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:Accessibility Accessibility docs size/s [PR only] 6-50 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aria-label can be used on non-interactive elements
2 participants