w3c / html-aria

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

Clarification regarding implicit role for table elements #506

Open giacomo-petri opened 5 months ago

giacomo-petri commented 5 months ago

The implicit role for <table> elements is role="table".

It might be beneficial to include a note indicating that, in cases where the table lacks table headers, it could potentially be interpreted and presented as a "generic" element.

For instance, in accessibility inspectors:

scottaohara commented 5 months ago

Before that's done here (as the implicit roles that are mentioned here are not defined by this spec, but rather by HTML AAM), it needs to be specified in HTML AAM.

what you're describing is unfortunately not normatively defined, but one of the ways browsers have evolved handling tables over the years.

similar to Apple removing list semantics from list elements when the list markers are removed. That's not defined anywhere, so it's not called out here or in HTML AAM either (and by that i mean the spec doesn't say the list element can either be a role=list or role=generic - that is just how apple decided to handle this beyond what the spec states they need to do. similarly for the table heuristics you call out).

giacomo-petri commented 5 months ago

@scottaohara, I was contemplating introducing a note similar to the one for the summary element, considering the explicit mention of layout tables in the WCAG. On the other hand, if we extend this practice to tables, there could be other elements with comparable situations worth considering...

About the HTML AAM topic, the discussion on list items could be contentious, given the potential use of a list structure with list-style-type:none while still aiming to preserve and convey the semantic meaning of a list (e.g., in scenarios like a product listing page on a retail website.) This aspect leans towards being a decision for browser implementors, guided by specific assumptions.

In contrast, the table topic differs a bit. WCAG addresses layout tables in its failures, explicitly prohibiting the use of th, caption, and summary. Consequently, for layout tables, it seems reasonable to assign a generic implicit role.

Do you think this should be discussed and maybe considered and documented in HTML AAM?