w3c / html-aria

ARIA in HTML
https://w3c.github.io/html-aria/
Other
178 stars 48 forks source link

Clarification regarding explicit allowed role for section elements #505

Open giacomo-petri opened 5 months ago

giacomo-petri commented 5 months ago

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 commented 5 months ago

@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 commented 5 months ago

Thanks for the feedback @stevefaulkner,

my inquiry is as follows:

OR

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

giacomo-petri commented 5 months ago

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

giacomo-petri commented 5 months ago

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.

scottaohara commented 5 months ago

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 commented 5 months ago

@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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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

giacomo-petri commented 5 months ago

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 commented 5 months ago

thanks @giacomo-petri