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

refactor: Remove generic aria role from types #4610

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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

Coverage Status

coverage: 99.615%. remained the same
when pulling da7b063 on refactor/disallow-generic-aria-role
into bb68456 on main.

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