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

HTML elements should not have redundant roles #598

Open
gnpivo opened this issue May 9, 2024 · 1 comment
Open

HTML elements should not have redundant roles #598

gnpivo opened this issue May 9, 2024 · 1 comment
Assignees

Comments

@gnpivo
Copy link

gnpivo commented May 9, 2024

Hi. The Page Regions in HTML5 Using WAI-ARIA section suggests using both the HTML element and its corresponding role:

<header role="banner"></header>
<main role="main"></main>
<nav role="navigation"></nav>
<footer role="contentinfo"></footer>

However, the ARIA in HTML recommendation specifically discourages this usage:

The following example illustrates a button element which has also been provided an explicit role=button. Specifying this role is unnecessary, as a "button" element is already exposed with an implicit button role. In practice this particular instance of redundancy will likely not have unforeseen side effects, other than unnecessarily making the markup more verbose, and incorrectly signaling to other authors that this practice is useful. Please review the section 3.3 Be cautious of side effects for an example of where specifying unnecessary roles can be problematic.

<!-- Avoid doing this! -->
<button role="button">...</button>

I believe the tutorial should be modified to conform with the recommendation by not encouraging the use of redundant roles.

@brianelton brianelton self-assigned this May 10, 2024
@brianelton
Copy link

I agree. This section could probably be removed completely. The HTML4 section provides sufficient information for the use of ARIA roles when HTML5 can not be used.

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

No branches or pull requests

3 participants