Name not calculated from contents for <td> beneath role="grid"
Categories
(Core :: Disability Access APIs, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox70 | --- | verified |
People
(Reporter: Jamie, Assigned: mislam)
References
(Blocks 1 open bug)
Details
(Whiteboard: [lang=c++])
Attachments
(1 file)
STR:
- Open this test case:
data:text/html,<table role="grid"><tr><td>foo</td></tr></table>
- Right click on the cell and select Inspect Accessibility Properties.
- Check the name.
Expected: "foo"
Actual: null
If you put role="gridcell" on the td, it works as expected, since gridcell supports name from contents. However, the HTML AAM spec says that a td with an ancestor table with role="grid" should be mapped to ARIA role gridcell:
https://www.w3.org/TR/html-aam-1.0/#html-element-role-mappings
That means the gridcell rules apply here; i.e. that we should do name from contents.
Note that td in a table role="table" maps to role="cell" and the spec requires name from contents for role "cell" as well:
https://www.w3.org/TR/wai-aria-1.2/#cell
That means we need the same thing for role="table".
Interestingly, we're failing to do name from contents even if you explicitly specify role="cell" on the td.
It may be worth considering just always doing name from contents for td elements. Chrome does this already. It makes some sense: why do name from contents for role="cell" but not for td? It'd also be a lot simpler to implement, since we can just tweak the Gecko cell role, rather than special casing for ARIA tables and grids.
Reporter | ||
Comment 1•6 years ago
|
||
This was reported by the JAWS vendor. It shows up in a W3C example here:
https://www.w3.org/TR/wai-aria-practices/examples/grid/dataGrids.html
Reporter | ||
Comment 2•6 years ago
|
||
The CELL role needs to be changed so that it uses eNameFromSubtreeRule instead of eNameFromSubtreeIfReqRule:
https://searchfox.org/mozilla-central/rev/227f5329f75bd8b16c6b146a7414598a420260cb/accessible/base/RoleMap.h#288
Reporter | ||
Comment 3•6 years ago
|
||
Based on bug 1568360 (tr elements getting excessively long names in the case of layout tables), I don't think we want to tweak the Gecko CELL role as I originally suggested. However, some spec discussion in that bug raises an interesting question:
Should the tr and td elements here get a name calculated for them? Yes, they have an ancestor with role="grid". However, as discussed in bug 1568360 comment 5, the spec states:
5.12.1 tr, td, th Elements Accessible Name Computation
- If the table element has an aria-label or an aria-labelledby attribute the accessible name is to be calculated using the algorithm defined in Accessible Name and Description: Computation and API Mappings 1.1.
- Otherwise use the title attribute.
- If none of the above yield a usable text string there is no accessible name.
So which name computation requirements take precedence here: the td rule above or the implicit gridcell role? in bug 1568360, we went with the td rule. But to make the W3C example referenced in comment 1 work, we'd have to take the implicit gridcell role rule.
Scott, can you shed any light on this?
Removing mentor until we clear this up.
Comment 4•6 years ago
|
||
Hey there.
So two things here.
- I still need to revise 5.12.1 to separate out tr from td/th. Hopefully will get that done sooner than later.
- For this particular issue/example, because the table role has been changed to a grid, the TDs should implicitly be gridcells, so rules for that role would apply instead of the default HTML element expectations.
Hoping that helps clarify.
Reporter | ||
Comment 5•6 years ago
|
||
Let's just deal with the implicit gridcell case here.
ARIA gridcell gets mapped to Gecko role GRID_CELL, which calculates name from subtree. However, we don't have logic to map the implicit gridcell case.
This can probably be done in Accessible::ARIATransformRole. If the role is CELL, get the table (Accessible::AsTableCell, TableCellAccessible::Table). If the table has ARIA role grid (Accessible::IsARIARole), return GRID_CELL.
Add test in accessible/tests/mochitest/role/test_aria.html.
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 6•6 years ago
|
||
Assignee | ||
Comment 7•6 years ago
•
|
||
For this piece of code:
<div id="crazy_grid2" role="grid">
<table role="presentation">
<tr role="row">
<td id="ct_cell1">cell1</td>
<td role="gridcell">cell2</td>
</tr>
</table>
</div>
should ct_cell1
have an implicit gridcell
role?
Reporter | ||
Comment 8•6 years ago
|
||
Eek. That's tricky. I can't see anything in the spec which suggests it should. On the other hand, intuitively, it makes sense that it does. I don't think that behaviour violates the spec at least, so I'd probably just update the test.
Comment 10•6 years ago
|
||
bugherder |
Comment 11•6 years ago
|
||
bugherder uplift |
Updated•6 years ago
|
Comment 12•5 years ago
|
||
Reproduced the issue with Firefox 66.0a1 (20190123165704) on Windows 10x64. The issue is verified with Firefox 70.0b9 (20190923154733) on Windows 10x64.
Description
•