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

Add checkAllHTMLElements option to no-redundant-landmark-role rule to lint against all HTML elements with default ARIA roles #2487

Conversation

judithhinlung
Copy link
Collaborator

@judithhinlung judithhinlung commented Apr 26, 2022

This PR fixes #2485.

Background

Most HTML elements have default/implicit ARIA roles, and setting a role that matches an element's default has no effect.

This PR adds an option, checkAllElementRoles, in the config for the existing no-redundant-landmark-role rule to expand its coverage to lint against all HTML elements with default roles.
This PR also adds the nav element and the navigation role to the list of allowed element-role pairings, as advised by the W3 for accessibility, and the footer element and contentinfo role are removed due to redundancy in their functions.

References:

Allowed:

# examples
<nav role="navigation"></nav>
<form role="search"></form>
<input type="text" />

Forbidden:

# examples
<footer role="contentinfo"></footer>
<input type="checkbox" name="agree" value="checkbox1" role="checkbox" />
<select name="color" id="color" role="listbox" multiple><option value="default-color">black</option></select>

Testing

Tests: 5 skipped, 7545 passed, 7550 total
Snapshots: 990 passed, 990 total
Time: 139.005 s, estimated 159 s
Ran all test suites.
✨ Done in 152.69s.

…nst all HTML elements with default ARIA roles
@judithhinlung judithhinlung marked this pull request as ready for review April 27, 2022 18:04
Copy link
Member

@bmish bmish left a comment

Choose a reason for hiding this comment

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

Does the rule need to be renamed eventually?

docs/rule/no-redundant-landmark-role.md Outdated Show resolved Hide resolved
@judithhinlung
Copy link
Collaborator Author

Yes I think renaming this rule eventually will make its purpose more clear.

@bmish
Copy link
Member

bmish commented Apr 27, 2022

@judithhinlung can you suggest a future name for it? That way, we can add it to the list of breaking changes in #2319.

@bmish bmish mentioned this pull request Apr 27, 2022
@bmish bmish changed the title Updates no-redundant-landmark-role rule with an option to lint against all HTML elements with default ARIA roles Add checkAllHTMLElements option to no-redundant-landmark-role rule to lint against all HTML elements with default ARIA roles Apr 27, 2022
Copy link
Member

@bmish bmish left a comment

Choose a reason for hiding this comment

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

Thanks!

@judithhinlung
Copy link
Collaborator Author

I think renaming this to no-redundant-role would capture the essence of the rule.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants