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

feat(aria-label): new rule to flag incorrect use of aria-label, aria-labelledby, and aria-describeby #2712

Closed
wants to merge 5 commits into from

Conversation

straker
Copy link
Contributor

@straker straker commented Dec 22, 2020

Closes issue: #1575

@straker straker requested a review from a team as a code owner December 22, 2020 00:27
@straker straker changed the title feat(aria-label): new rule to flag incorrect use of aria-label feat(aria-label): new rule to flag incorrect use of aria-label, aria-labelledby, and aria-describeby Dec 23, 2020
Comment on lines +6 to +7
"description": "Ensure aria-label(ledby) is only used on non-static elements",
"help": "Use aria-label, aria-labelledby, and aria-describedby on elements with non-static roles"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like to see some test data on this. What is the problem we are solving with this rule?

Copy link
Contributor

@WilcoFiers WilcoFiers left a comment

Choose a reason for hiding this comment

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

We're going to need to run this rule by the JC. Can you do some testing for this to show what the problem is that comes from this? I suspect we're going to get complaints about this one.

@straker
Copy link
Contributor Author

straker commented Jan 12, 2021

I think this PR is not needed and we should instead use the Prohibited States and Props from ARIA 1.2 as they cover this exact use case but in a more generic way.

Related discussions:

@straker
Copy link
Contributor Author

straker commented Jan 13, 2021

Note, this may not work with the <i> attribute as it doesn't have a role mapping. I will do some testing aria-label on different elements to see how screen readers handle it.

@straker
Copy link
Contributor Author

straker commented Jan 13, 2021

From Scott O'Hara on asking about HTML elements with no role mapping:

no mapping = generic
generic doesn't allow naming

@straker
Copy link
Contributor Author

straker commented Jan 13, 2021

Tested the following DOM in different browsers:

<div aria-label="my label">foo</div>
<span aria-label="my label">foo</span>
<i aria-label="my label">foo</i>
<p aria-label="my label">foo</p>

<div id="label">my label</div>
<div aria-labelledby="label">foo</div>
<span aria-labelledby="label">foo</span>
<i aria-labelledby="label">foo</i>
<p aria-labelledby="label">foo</p>

No browser / screen reader combination read the aria-label or the aria-labelledby attributes. All names returned as "foo"

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

Successfully merging this pull request may close these issues.

2 participants