Closed Bug 1522383 Opened 6 years ago Closed 6 years ago

Name not calculated from contents for <td> beneath role="grid"

Categories

(Core :: Disability Access APIs, defect, P2)

defect

Tracking

()

VERIFIED FIXED
mozilla70
Tracking Status
firefox70 --- verified

People

(Reporter: Jamie, Assigned: mislam)

References

(Blocks 1 open bug)

Details

(Whiteboard: [lang=c++])

Attachments

(1 file)

STR:

  1. Open this test case: data:text/html,<table role="grid"><tr><td>foo</td></tr></table>
  2. Right click on the cell and select Inspect Accessibility Properties.
  3. 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.

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

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

Mentor: jteh
Whiteboard: [lang=c++]

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

  1. 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.
  2. Otherwise use the title attribute.
  3. 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.

Mentor: jteh
Flags: needinfo?(scottaohara)

Hey there.

So two things here.

  1. I still need to revise 5.12.1 to separate out tr from td/th. Hopefully will get that done sooner than later.
  2. 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.

Flags: needinfo?(scottaohara)

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: nobody → mislam

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?

Flags: needinfo?(jteh)

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.

Flags: needinfo?(jteh)
Pushed by jteh@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ecf3e6779493 Assign gridcell role to cells inside a table with grid role, r=Jamie
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70

Reproduced the issue with Firefox 66.0a1 (20190123165704) on Windows 10x64. The issue is verified with Firefox 70.0b9 (20190923154733) on Windows 10x64.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
Blocks: 1893096
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: