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

Clarification regarding explicit allowed role for section elements #505

Open
giacomo-petri opened this issue Jan 31, 2024 · 11 comments
Open

Comments

@giacomo-petri
Copy link
Contributor

In the "ARIA Attribute Usage by HTML Element Rules" table, the "ARIA Role, State, and Property Allowances" related to the <section> element specifies the following:

Roles: alert, alertdialog, application, banner, complementary, contentinfo, dialog, document, feed, group, log, main, marquee, navigation, none, note, presentation, search, status or tabpanel. (role=region is also allowed, but NOT RECOMMENDED. role=generic SHOULD NOT be used.)

Are we implying that, despite discouraging the use of "generic," it is permissible to designate a section with an accessible name (thus having an implicit role="region") as a generic container by explicitly setting role="generic"?

Alternatively, are we asserting that the explicit role="generic" is prohibited for section elements with an accessible name?

Does the statement "should not be used" only apply when the implicit role is generic, as is the case with other HTML elements where the explicit role mirrors the implicit role?

I think it would be beneficial to provide clarification on this aspect.

@stevefaulkner
Copy link
Collaborator

@giacomo-petri if you look at the role definition in the ARIA spec https://www.w3.org/TR/wai-aria-1.2/#generic it states 

Authors SHOULD NOT use this role in content.

@giacomo-petri
Copy link
Contributor Author

giacomo-petri commented Jan 31, 2024

Thanks for the feedback @stevefaulkner,

my inquiry is as follows:

  • it "SHOULD NOT be used" always applicable, regardless the implicit role? (as is right now)

OR

  • it "SHOULD NOT be used" if the implicit role is region (due to acc name)?
  • AND it is "NOT RECOMMENDED" if the implicit role is generic?

(which to me seems more consistent with other statements for other HTML elements)

@giacomo-petri
Copy link
Contributor Author

Sorry, got it. I'm closing this ticket.

@giacomo-petri
Copy link
Contributor Author

Reopening for further clarification.

In certain cases, the directive to "SHOULD NOT be used" is not explicitly applied to the generic role, as seen with the tfoot element:

tfoot role=rowgroup Any role, though rowgroup is NOT RECOMMENDED.

Would it be more clear to eliminate the individual instances of the generic role requirement and, instead, incorporate it elsewhere (e.g. at the very beginning, at the end or as a footnote) with a specification that it SHOULD never be used?

Otherwise, it appears that depending on the implicit role of the element, there are instances where its use might be acceptable.

@giacomo-petri giacomo-petri reopened this Jan 31, 2024
@scottaohara
Copy link
Member

the ARIA spec already states that role=generic should not be used by developers. if we stated that here again, we would just be duplicating the existing rule in the ARIA spec.

@giacomo-petri
Copy link
Contributor Author

giacomo-petri commented Jan 31, 2024

@scottaohara, I would agree with you not duplicating the existing rule in the ARIA spec, but I'm still missing something.

For instance, in cases like the section element, the requirement outlines:

Roles: alert, alertdialog, application, banner, complementary, contentinfo, dialog, document, feed, group, log, main, marquee, navigation, none, note, presentation, search, status or tabpanel. (role=region is also allowed, but NOT RECOMMENDED. role=generic SHOULD NOT be used.)

On the other hand, scenarios like tfoot simply state that any role is acceptable:

Any role, though rowgroup is NOT RECOMMENDED.

I suggest maintaining consistency across requirements for various HTML elements to prevent confusion and misinterpretation.

In essence, the use of the generic role is discouraged for certain HTML elements, while for others, it is not explicitly mentioned.

Is there a distinction between the two scenarios that I might have overlooked?

@scottaohara
Copy link
Member

scottaohara commented Jan 31, 2024

you're noticing that for the elements where generic is either the implicit role, or one of the implicit roles, it is specifically called out as should not be used.

but for instances where it is not an implicit role, it is not called out.

@giacomo-petri
Copy link
Contributor Author

giacomo-petri commented Jan 31, 2024

Appreciate it, @scottaohara,

Feeling a bit weary :D, so not entirely sure about my confusion source. Perhaps I anticipated a statement for the section element, similar to other scenarios:

"Otherwise, role=generic is also allowed, but SHOULD NOT be used."

Additionally, the list item element might benefit from mentioning the "generic" statement when the implicit role is generic (for consistency).

Nevertheless, it's a minor note.

Closing the ticket.

@scottaohara
Copy link
Member

yah, there is an inconsistency with the list item one.

i wonder, would you find it better if generic were instead just not mentioned as a separate call out? since the ARIA spec already says it shouldn't be used, and actually, this spec already states

However, it is NOT RECOMMENDED for authors to specify the implicit role of the element, the generic role, or a role deprecated by ARIA on these elements

in the paragraphs that introduce the usage table

@scottaohara scottaohara reopened this Jan 31, 2024
@giacomo-petri
Copy link
Contributor Author

In my view, simplicity and clarity are enhanced by confining the Any role definition to the paragraphs introducing the usage table. This approach may also foster greater consistency, eliminating the need to explicitly caution against using the generic role for each element with a generic implicit role.

In my perspective, stating that the generic role SHOULD NOT be applied to elements with implicit generic roles, while not applying the same caution to other elements with an "Any role," particularly when these elements are consecutive, could lead to more confusion than clarity.

@scottaohara
Copy link
Member

thanks @giacomo-petri

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

No branches or pull requests

3 participants