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: Break up duplicate-id rule for ARIA+labels and for active elements #1097

Merged
merged 5 commits into from
Aug 24, 2018

Conversation

WilcoFiers
Copy link
Contributor

Break the duplicate-id rule up into three rules:

  • duplicate-id-aria: Test the IDs referenced with aria and with label[for] are unique
  • duplicate-id-active: Test that focusable elements have a unique ID
  • duplicate-id: Check that all other IDs are unique

Closes #163

Reviewer checks

Required fields, to be filled out by PR reviewer(s)

  • Follows the commit message policy, appropriate for next version
  • Has documentation updated, a DU ticket, or requires no documentation change
  • Includes new tests, or was unnecessary
  • Code is reviewed for security by: << Name here >>

@WilcoFiers WilcoFiers requested a review from a team as a code owner August 24, 2018 12:38
Copy link
Contributor

@dylanb dylanb left a comment

Choose a reason for hiding this comment

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

Some small tweaks to the messages and (optionally) a few more tests and this is good to go

"impact": "critical",
"messages": {
"pass": "Document has no elements referenced with ARIA or labels that share the same id attribute",
"fail": "Document has multiple elements referenced with ARIA or with the same id attribute: {{=it.data}}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Change to Document has multiple elements referenced with ARIA with the same id attribute: {{=it.data}}

@@ -3,7 +3,7 @@
"evaluate": "duplicate-id.js",
"after": "duplicate-id-after.js",
"metadata": {
"impact": "moderate",
"impact": "minor",
"messages": {
"pass": "Document has no elements that share the same id attribute",
"fail": "Document has multiple elements with the same id attribute: {{=it.data}}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Change this to Document has multiple static elements with the same id attribute?

</div>

<button id="fail1" class="fail1"></button>
<button id="fail1"></button>
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have more examples of failures? For example a <div tabindex="-1" id="fail2">blah</div><input id="fail2" /> etc.?

Copy link
Contributor

@jeeyyy jeeyyy left a comment

Choose a reason for hiding this comment

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

Lgtm.

@paulirish
Copy link
Contributor

It took us a while to find it, but thanks for doing this.

We really like this approach and agree it's got much higher signal:noise. :)

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.

More impactful duplicate ID check option
4 participants