Bug 1522383 - Assign gridcell role to cells inside a table with grid role, r=Jamie

Differential Revision: https://phabricator.services.mozilla.com/D43858

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Maliha Islam 2019-08-29 10:09:48 +00:00
Родитель ae92071aa2
Коммит 829cc15e27
3 изменённых файлов: 23 добавлений и 3 удалений

Просмотреть файл

@ -1508,6 +1508,18 @@ role Accessible::ARIATransformRole(role aRole) const {
nsGkAtoms::_true, eCaseMatters)) {
return roles::PARENT_MENUITEM;
}
} else if (aRole == roles::CELL) {
// A cell inside an ancestor table element that has a grid role needs a
// gridcell role
// (https://www.w3.org/TR/html-aam-1.0/#html-element-role-mappings).
const TableCellAccessible* cell = AsTableCell();
if (cell) {
TableAccessible* table = cell->Table();
if (table && table->AsAccessible()->IsARIARole(nsGkAtoms::grid)) {
return roles::GRID_CELL;
}
}
}
return aRole;

Просмотреть файл

@ -141,6 +141,7 @@
// ////////////////////////////////////////////////////////////////////////
// roles transformed by ARIA state attributes
testRole("togglebutton", ROLE_TOGGLE_BUTTON);
testRole("implicit_gridcell", ROLE_GRID_CELL);
// ////////////////////////////////////////////////////////////////////////
// ignore unknown roles, take first known
@ -344,6 +345,13 @@
<div role="section" id="section">section</div>
<div role="sectionhead" id="sectionhead">sectionhead</div>
<!-- roles transformed by ARIA roles of ancestors -->
<table role="grid">
<tr>
<td id="implicit_gridcell">foo</td>
</tr>
</table>
<!-- roles transformed by ARIA state attributes -->
<button aria-pressed="true" id="togglebutton">

Просмотреть файл

@ -73,8 +73,8 @@
role: ROLE_ROW,
tagName: "TR",
children: [
{ // td generic cell accessible
role: ROLE_CELL,
{ // td implicit role="gridcell"
role: ROLE_GRID_CELL,
children: [
{ // td text leaf
role: ROLE_TEXT_LEAF,
@ -231,7 +231,7 @@
<div id="crazy_grid2" role="grid">
<table role="presentation">
<tr role="row">
<td id="ct_cell1">cell1</td>
<td id="implicit_gridcell">cell1</td>
<td role="gridcell">cell2</td>
</tr>
</table>