aria-practices icon indicating copy to clipboard operation
aria-practices copied to clipboard

Do not use `rowgroup` role for table body

Open knowler opened this issue 10 months ago • 5 comments

While the tbody HTML element is supposed to map to the rowgroup ARIA role, no browser implements this and this seems warranted because neither NVDA or JAWS can navigate by cell when a table’s body has a rowgroup role on it. Currently, the Table pattern uses role=rowgroup for the table body. I think for now it should not and perhaps a note should be added. Whether we like it or not, developers do thoughtlessly copy these patterns without testing.

Cross-reference: https://github.com/w3c/html-aam/issues/474

The ARIA spec for rowgroup also calls out a spec issue related to this:

NOTE This role does not differentiate between types of row groups (e.g., thead vs. tbody), but an issue has been raised for WAI-ARIA 2.0.

knowler avatar Feb 07 '25 19:02 knowler

The ARIA Authoring Practices (APG) Task Force just discussed Issue 3232 - rowgroup for table body.

The full IRC log of that discussion <jugglinmike> Topic: Issue 3232 - rowgroup for table body
<jugglinmike> github: https://github.com/w3c/aria-practices/issues/3232
<jugglinmike> Matt_King: It's not clear to me how much of a problem this is in practice
<jugglinmike> Matt_King: Apparently, our table example (where we build a table from divs and spans in order to illustrate the "table" role) uses the "rowgroup" role to represent the table body
<jugglinmike> Matt_King: The reporter is saying that none of the browsers map it that way
<jugglinmike> Matt_King: This seems like a problematic mapping in the first place.
<jugglinmike> Matt_King: The reporter says that neither NVDA nor JAWS can navigate by cell when this is done...
<jugglinmike> Matt_King: They provided a link to the HTML
<jugglinmike> CurtBellew: I'm assuming that it's pointing to the table example. If you look there, that example does use "rowgroup". I'm not sure I understand because I tried it with JAWS just to see if I could navigate using table navigation. So either I'm doing it differently or I'm not understanding the concern
<jugglinmike> Matt_King: So the table example is a table that has, like, "students", "first name", "last name", etc... I am able to navigate this with the JAWS table commands (alt + ctrl + left, right, up and down)
<jugglinmike> Matt_King: And then "alt+ctrl+end" does go to column 1 row five
<jugglinmike> Matt_King: I don't see that there's necessarily a functional problem here--at least not with JAWS
<jugglinmike> Matt_King: If we took out the divs that have "rowgroup" on them, it really wouldn't change anything, I don't think...
<jugglinmike> Matt_King: Looking at the HTML, there are two different rowgroups--one with one row (for the header), and one with the other three or four rows (with the body). But it's just a div with "role=rowgroup". I don't think it can do anything. It's not as though the one for the head is different from the one for the body.
<jugglinmike> Matt_King: Maybe we shouldn't have included them
<jugglinmike> CurtBellew: I took a quick spin with NVDA, and it was basically telling me that I wasn't in a table
<jugglinmike> Matt_King: Oh yeah. "Not in a table cell" is what NVDA says
<jugglinmike> Matt_King: Ah, but that's only when you're in the head row
<jugglinmike> Matt_King: It seems to think that essentially the first row in the body is the first row in the table
<jugglinmike> Matt_King: That gives me reason to think that if we got rid of the rowgroups, it would treat all the rows the same
<jugglinmike> CurtBellew: I'm going to a really simple WebAIM table, and I'm not able to get out of the table, there. This is very strange
<jugglinmike> Matt_King: The reporter links to HTML-AAM issue #474
<jugglinmike> Matt_King: But this is going in the other direction. It's like when some of the browsers are taking thead, etc and translating them into "role=none". That's Chrome and WebKit which are doing that...
<jugglinmike> Matt_King: Should we take out the "rowgroup"s
<jugglinmike> arigilmore: I don't know! I don't think I have enough understanding on this one
<jugglinmike> Adam_Page: Ditto for me; I'd want to look into it more
<jugglinmike> CurtBellew: My initial thought is that I don't understand enough about why we implemented "rowgroup"s. For me, it seems logical that we could just remove them, but without knowing more of the history, I'm not so sure
<jugglinmike> Matt_King: From an accessibility point of view, I don't know what value these roles add
<jugglinmike> Matt_King: That's why this person is requesting their removal
<jugglinmike> Matt_King: Maybe CurtBellew can do some testing. If we can remove all the roles without impacting the behavior, then I think we should definitely remove them
<jugglinmike> CurtBellew: I'll do that testing and report back

css-meeting-bot avatar Feb 11 '25 19:02 css-meeting-bot

When you say you can't navigate by cell I'm not sure if I'm understanding. I did a quick test of the table pattern example using NVDA and JAWS and I was able to navigate the tables using table commands- Control+Alt+arrow keys. Is that the cell navigation you're referring to? Without knowing the history of the example I would guess rowgoup was included for completeness - probably. In html-aam#474 the respondents are indicating that the tbody and thead are treated like a role of none unless they are focusable or named, so for the most part they won't impact accessibility.

curtbellew avatar Feb 13 '25 16:02 curtbellew

In https://github.com/w3c/aria-practices/issues/3232#issuecomment-2657117133, @curtbellew said:

When you say you can't navigate by cell I'm not sure if I'm understanding. I did a quick test of the table pattern example using NVDA and JAWS and I was able to navigate the tables using table commands- Control+Alt+arrow keys. Is that the cell navigation you're referring to?

Yes — the arrow keys with ControlAlt. I had fairly consistent results across a variety of examples when I was testing this when I filed the issue, however, I had mixed results when I tested again after seeing the log of the discussion. I’ll try to find some time to determine whether or not it is a me-problem and I’ll try to document/capture it better.

knowler avatar Feb 14 '25 03:02 knowler

I retested with JAWS and NVDA. I had previously had difficulty using alt+ctrl+up to go into the header row with NVDA, but it is working for me now ... strange. Pretty sure it is same version of NVDA but probably different version of Chrome.

Regardless, the rowgroup elements do not serve any purpose. It seems that they add potential confusion and unnecessary code, which works against the objectives of the APG. So, I think we should treat this as a bug and drop the rowgroup elements from the example.

mcking65 avatar Feb 25 '25 16:02 mcking65

The ARIA Authoring Practices (APG) Task Force just discussed Issue 3232 - rowgroup for table body.

The full IRC log of that discussion <jugglinmike> Topic: Issue 3232 - rowgroup for table body
<jugglinmike> github: https://github.com/w3c/aria-practices/issues/3232
<jugglinmike> mk: We discussed this before. Both Kurt and I did some testing, and recently, the reporter reported that they can't reproduce the issue
<jugglinmike> s/recently/most recently/
<jugglinmike> mk: The "role=none" makes these elements extraneous.
<jugglinmike> mk: Because of that, they kind of work against the APG's goal to keep examples as simple and as pedagogical as possible
<jugglinmike> mk: I don't think we want to suggest to anyone that there is any value in having those "rowgroup" divs
<jugglinmike> mk: So, first question is: is everyone good with calling this a bug (and marking it as a "P3" priority)?
<jugglinmike> Adam_Page: Sounds good to me
<jugglinmike> mk: I should probably label this as a good first issue

css-meeting-bot avatar Feb 25 '25 19:02 css-meeting-bot