Skip to content

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

Closed
straker wants to merge 5 commits into
developfrom
aria-label
Closed

feat(aria-label): new rule to flag incorrect use of aria-label, aria-labelledby, and aria-describeby#2712
straker wants to merge 5 commits into
developfrom
aria-label

Conversation

@straker

@straker straker commented Dec 22, 2020

Copy link
Copy Markdown
Contributor

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 thread lib/rules/aria-label.json
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
Copy Markdown
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?

@WilcoFiers WilcoFiers left a comment

Copy link
Copy Markdown
Contributor

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

straker commented Jan 12, 2021

Copy link
Copy Markdown
Contributor Author

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

straker commented Jan 13, 2021

Copy link
Copy Markdown
Contributor Author

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

straker commented Jan 13, 2021

Copy link
Copy Markdown
Contributor Author

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

no mapping = generic
generic doesn't allow naming

@straker

straker commented Jan 13, 2021

Copy link
Copy Markdown
Contributor Author

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