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-allowed-attr): error when generic elements use aria-label and aria-labelledy #2766

Merged
merged 9 commits into from
Mar 5, 2021

Conversation

straker
Copy link
Contributor

@straker straker commented Jan 19, 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"

Note: The "proper" way to handle this would be if axe-core returned generic instead of null for nodes without a role. However, we are not set up to do that and It would require going through all use cases where we check for null role and changing it for generic. I'm not sure we want to do that just yet, but we should at least add a tech debt ticket to do so if this is merged.

Closes issue: #1575

@straker straker requested a review from a team as a code owner January 19, 2021 21:01
before(function() {
axe._load({});
});
it('should return a list of role names by type', function() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I got tired of updating this test when adding new roles. This should allow us to not have it change so often.

lib/checks/aria/aria-prohibited-attr-evaluate.js Outdated Show resolved Hide resolved
lib/standards/aria-roles.js Outdated Show resolved Hide resolved
@@ -1,4 +1,4 @@
describe.only('aria-prohibited-attr', function() {
describe('aria-prohibited-attr', function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Huh, odd.

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.

Very minor tweak.

lib/checks/aria/aria-prohibited-attr-evaluate.js Outdated Show resolved Hide resolved
.circleci/config.yml Outdated Show resolved Hide resolved
.circleci/config.yml Outdated Show resolved Hide resolved
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