Bug 888247 - ARIA columnheader/rowheader shouldn't be selectable by default, r=tbsaunde

This commit is contained in:
Alexander Surkov 2013-07-19 11:20:51 -04:00
Родитель 5103d820f9
Коммит 516c4c5af4
6 изменённых файлов: 58 добавлений и 12 удалений

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

@ -112,7 +112,7 @@ static nsRoleMapEntry sWAIRoleMaps[] =
eNoLiveAttr,
eTableCell,
kNoReqStates,
eARIASelectable,
eARIASelectableIfDefined,
eARIAReadonlyOrEditableIfDefined
},
{ // combobox
@ -463,7 +463,7 @@ static nsRoleMapEntry sWAIRoleMaps[] =
eNoLiveAttr,
eTableCell,
kNoReqStates,
eARIASelectable,
eARIASelectableIfDefined,
eARIAReadonlyOrEditableIfDefined
},
{ // scrollbar

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

@ -300,6 +300,16 @@ aria::MapToState(EStateRule aRule, dom::Element* aElement, uint64_t* aState)
return true;
}
case eARIASelectableIfDefined:
{
static const TokenTypeData data(
nsGkAtoms::aria_selected, eBoolType,
states::SELECTABLE, states::SELECTED);
MapTokenType(aElement, aState, data);
return true;
}
case eReadonlyUntilEditable:
{
if (!(*aState & states::EDITABLE))

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

@ -42,6 +42,7 @@ enum EStateRule
eARIAReadonlyOrEditableIfDefined,
eARIARequired,
eARIASelectable,
eARIASelectableIfDefined,
eReadonlyUntilEditable,
eIndeterminateIfNoValue
};

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

@ -465,8 +465,8 @@ ARIAGridAccessible::SetARIASelected(Accessible* aAccessible,
rv = content->SetAttr(kNameSpaceID_None, nsGkAtoms::aria_selected,
NS_LITERAL_STRING("true"), aNotify);
else
rv = content->UnsetAttr(kNameSpaceID_None,
nsGkAtoms::aria_selected, aNotify);
rv = content->SetAttr(kNameSpaceID_None, nsGkAtoms::aria_selected,
NS_LITERAL_STRING("false"), aNotify);
NS_ENSURE_SUCCESS(rv, rv);

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

@ -361,7 +361,8 @@ function testTableSelection(aIdentifier, aCellsArray, aMsg)
for (var colIdx = 0; colIdx < colsCount; colIdx++) {
var isColSelected = true;
for (var rowIdx = 0; rowIdx < rowCount; rowIdx++) {
if (aCellsArray[rowIdx][colIdx] == false) {
if (aCellsArray[rowIdx][colIdx] == false ||
aCellsArray[rowIdx][colIdx] == undefined) {
isColSelected = false;
break;
}
@ -401,7 +402,8 @@ function testTableSelection(aIdentifier, aCellsArray, aMsg)
for (var rowIdx = 0; rowIdx < rowCount; rowIdx++) {
var isRowSelected = true;
for (var colIdx = 0; colIdx < colsCount; colIdx++) {
if (aCellsArray[rowIdx][colIdx] == false) {
if (aCellsArray[rowIdx][colIdx] == false ||
aCellsArray[rowIdx][colIdx] == undefined) {
isRowSelected = false;
break;
}
@ -442,7 +444,8 @@ function testTableSelection(aIdentifier, aCellsArray, aMsg)
if (aCellsArray[rowIdx][colIdx] & kSpanned)
continue;
is(acc.isCellSelected(rowIdx, colIdx), aCellsArray[rowIdx][colIdx],
var isSelected = aCellsArray[rowIdx][colIdx] == true;
is(acc.isCellSelected(rowIdx, colIdx), isSelected,
msg + "Wrong selection state of cell at " + rowIdx + " row and " +
colIdx + " column for " + prettyName(aIdentifier));
@ -496,7 +499,9 @@ function testTableSelection(aIdentifier, aCellsArray, aMsg)
var cell = acc.getCellAt(rowIdx, colIdx);
var isSel = aCellsArray[rowIdx][colIdx];
if (isSel)
if (isSel == undefined)
testStates(cell, 0, 0, STATE_SELECTABLE | STATE_SELECTED);
else if (isSel == true)
testStates(cell, STATE_SELECTED);
else
testStates(cell, STATE_SELECTABLE, 0, STATE_SELECTED);

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

@ -54,6 +54,21 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=410052
testUnselectTableColumn("grid2", 0, cellsArray);
testUnselectTableRow("grid2", 0, cellsArray);
//////////////////////////////////////////////////////////////////////////
// ARIA grid (column and row headers)
cellsArray =
[
[ undefined, true, false],
[ undefined, true, false]
];
testTableSelection("grid3", cellsArray);
testSelectTableColumn("grid3", 0, cellsArray);
testSelectTableRow("grid3", 0, cellsArray);
testUnselectTableColumn("grid3", 0, cellsArray);
testUnselectTableRow("grid3", 0, cellsArray);
SimpleTest.finish();
}
@ -65,10 +80,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=410052
<a target="_blank"
title="implement nsIAccessibleTable selection methods for ARIA grids"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=410052">Mozilla Bug 410052</a>
href="https://bugzilla.mozilla.org/show_bug.cgi?id=410052">Bug 410052</a>
<a target="_blank"
title="nsHTMLTableCellAccessible is used in dojo's crazy ARIA grid"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=513848">Mozilla Bug 513848</a>
href="https://bugzilla.mozilla.org/show_bug.cgi?id=513848">Bug 513848</a>
<a target="_blank"
title="ARIA columnheader/rowheader shouldn't be selectable by default"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=888247">Bug 888247</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
@ -112,8 +130,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=410052
<div role="row">
<table role="presentation">
<tr>
<td role="columnheader">header1</td>
<td role="columnheader">header2</td>
<td role="columnheader" aria-selected="false">header1</td>
<td role="columnheader" aria-selected="false">header2</td>
</tr>
</table>
</div>
@ -127,5 +145,17 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=410052
</div>
</div>
<div role="grid" id="grid3">
<div role="row">
<div role="columnheader" id="colheader_default">col header1</div>
<div role="columnheader" id="colheader_selected" aria-selected="true">col header2</div>
<div role="columnheader" id="colheader_notselected" aria-selected="false">col header3</div>
</div>
<div role="row">
<div role="rowheader" id="rowheader_default">row header1</div>
<div role="rowheader" id="rowheader_selected" aria-selected="true">row header2</div>
<div role="rowheader" id="rowheader_notselected" aria-selected="false">row header3</div>
</div>
</div>
</body>
</html>