Skip to content

Conversation

@phsantiago
Copy link
Contributor

@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
{{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
Contributor 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.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 19, 2024

Preview URLs

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

@phsantiago
Copy link
Contributor 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 phsantiago requested a review from scottaohara August 26, 2024 20:19
@phsantiago
Copy link
Contributor 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

@phsantiago
Copy link
Contributor Author

Hi @scottaohara, just following up on this PR as it’s been a few weeks since my last re-review request. I’ve addressed the feedback, and would really appreciate it if you could take another look when you have time. Thanks again!

@Josh-Cena Josh-Cena requested a review from estelle October 15, 2024 18:39
@Josh-Cena
Copy link
Member

Perhaps @estelle could also review this, if @scottaohara could not

@Josh-Cena Josh-Cena merged commit 2023c16 into mdn:main Oct 15, 2024
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

3 participants