The aria-rowindex attribute being permitted on cells seems like a footgun #1138
Labels
clarification
clarifying or correcting language that is either confusing, misleading or under-specified
Milestone
The
aria-rowindex
attribute is permitted on elements with the rolescell
,row
,columnheader
,gridcell
, androwheader
.In the case of role
row
, it’s explained well what the meaning ofaria-rowindex
is.Regarding the rest, the spec says “Authors MAY also place aria-rowindex on all of the children or owned elements of each row.”
Also regarding the rest, statements are made like “Authors MUST ensure elements with role gridcell are contained in, or owned by, an element with the role row.”
I think this is pretty confusing for two reasons.
First, I don’t think it’s stated that if
aria-rowindex
is present on arole=cell
(etc) element that the indicated index must be the same as the explicit or implicit index of the required ancestor/owner row-roled element. However it seems like it must be, right? If not, it’s not explained what would happen. Assuming it does need to be, then, it’s unclear what purpose there would be to adding the attribute to anything other than a row-roled element.The bigger issue is that I think this sets up a misuse booby-trap for devs. If you look up
aria-rowindex
, you’ll learn that it’s legal on cells — and there’s a chance that’s exactly what you were hoping to find, because a natural question is “can I usearia-rowindex
on my gridcells to communicate position instead of having row-roled element parents?”The answer is no, but to learn that you have to look at the definitions of the roles, not the attribute, so it’s easy to mistake ‘permitted on gridcell’ for yes. This is significant because the requirement for row elements is no longer as obvious as it once was. Due to CSS grid layout, the requirement for rows makes grid-related JS, HTML and CSS all more complex than they would otherwise need to be, which is why I think a lot of people will be looking up this property to check if it’s a valid alternative.
In other words:
My suggestion would be to include a note in the
aria-rowindex
definition that explains that it isn’t a valid alternative to having row-roled elements. But it’s also possible I’m misunderstanding something significant here, since it seems pretty odd for an attribute to be explicitly permitted on elements where it would seemingly never do anything.The text was updated successfully, but these errors were encountered: