Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

rschristian
Copy link
Member

@rschristian rschristian commented Dec 16, 2024

Spec

ARIA also defines a generic role which is meant to provide feature parity with a number of HTML elements that do not have more specific ARIA semantics of their own. For instance, HTML's div and span elements, among others. ARIA discourages authors from using the generic role as its intended purpose is for use by implementors of user agents.

In the following example, rather than using a generic role, authors are advised to use a div in place of the article element. If changing the HTML element is not possible, specifying a role of presentation or none would be acceptable alternaties to remove the implicit role of the article.

Example 9: Do not specify elements as generic

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

The language used is pretty weak, ("SHOULD NOT" rather than "MUST NOT"), but the intention is clearly that the generic role is only meant for implicit use by user agents, not end users.

I've been searching over the past few days and have yet to find a single situation in which role="generic" adds any improvement and is recommended over the alternatives (like 'presentation') but haven't come up with anything. Therefore, I think removal is correct & an improvement to our types. Technically a valid string value but there's no reason why someone should ever set it.

@coveralls
Copy link

coveralls commented Dec 16, 2024

Coverage Status

coverage: 99.616%. remained the same
when pulling b09d11b on refactor/disallow-generic-aria-role
into 055cc5b on main.

@rschristian rschristian merged commit df1f20d into main Dec 31, 2024
5 checks passed
@rschristian rschristian deleted the refactor/disallow-generic-aria-role branch December 31, 2024 19:31
@JoviDeCroock JoviDeCroock mentioned this pull request Feb 16, 2025
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.

3 participants