Description
Currently the allowed roles for an <a>
element with an href
attribute are: button, checkbox, menuitem, menuitemcheckbox, menuitemradio, option, radio, switch, tab or treeitem. I think row
, cell
, and gridcell
should be added to this list. It is very common to build tables, lists, cards, tags, and other UI controls using the ARIA grid pattern. Often times, the rows or cells in these patterns need to be clickable to perform a navigation to a different page, for example, a detail page for an object in a table row. While these roles allow placing a link inside the cells (unlike the currently listed rows), clicking on the entire row is often desirable to give users a larger hit target.
We can perform navigation via JavaScript when clicking on a row, but this means that native browser behavior such as opening in a new tab is not available. It would be nice to be able to simply use <a role="row" href="...">
instead of relying on JavaScript. This already seems to work fine with screen readers in my testing, but due to the spec restriction is flagged by automated accessibility checkers. The role
override on the <a>
element means that nested content is accessible, unlike a regular link. The only difference from a <div role="row">
or a <tr>
is that the browser default click behavior works as expected rather than needing JavaScript. Therefore I do not see a downside to allowing this.