Bug 1359482: Don't expose the editable state on ARIA grids and gridcells. r=eeejay

The editable state is about navigable text (with a caret), not editable as in "not read only".
ATs don't want this exposed for grids and it causes problems for them.
They can (and already do) distinguish between gridcell and cell using xml-roles.

Differential Revision: https://phabricator.services.mozilla.com/D101707
This commit is contained in:
James Teh 2021-01-15 01:32:13 +00:00
Родитель 1b03a29fb6
Коммит 0646b214b4
5 изменённых файлов: 38 добавлений и 48 удалений

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

@ -162,7 +162,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = {
eTableCell,
kNoReqStates,
eARIASelectableIfDefined,
eARIAReadonlyOrEditableIfDefined
eARIAReadonly
},
{ // combobox, which consists of text input and popup
nsGkAtoms::combobox,
@ -707,7 +707,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = {
eSelect | eTable,
kNoReqStates,
eARIAMultiSelectable,
eARIAReadonlyOrEditable,
eARIAReadonly,
eFocusableUntilDisabled
},
{ // gridcell
@ -720,7 +720,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = {
eTableCell,
kNoReqStates,
eARIASelectable,
eARIAReadonlyOrEditableIfDefined
eARIAReadonly
},
{ // group
nsGkAtoms::group,
@ -1058,7 +1058,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = {
eTableCell,
kNoReqStates,
eARIASelectableIfDefined,
eARIAReadonlyOrEditableIfDefined
eARIAReadonly
},
{ // scrollbar
nsGkAtoms::scrollbar,
@ -1280,7 +1280,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = {
eNoLiveAttr,
eSelect | eTable,
kNoReqStates,
eARIAReadonlyOrEditable,
eARIAReadonly,
eARIAMultiSelectable,
eFocusableUntilDisabled,
eARIAOrientation

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

@ -233,14 +233,6 @@ bool aria::MapToState(EStateRule aRule, dom::Element* aElement,
return true;
}
case eARIAReadonlyOrEditableIfDefined: {
static const TokenTypeData data(nsGkAtoms::aria_readonly, eBoolType, 0,
states::READONLY, states::EDITABLE);
MapTokenType(aElement, aState, data);
return true;
}
case eARIARequired: {
static const TokenTypeData data(nsGkAtoms::aria_required, eBoolType, 0,
states::REQUIRED);

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

@ -40,7 +40,6 @@ enum EStateRule {
eARIAPressed,
eARIAReadonly,
eARIAReadonlyOrEditable,
eARIAReadonlyOrEditableIfDefined,
eARIARequired,
eARIASelectable,
eARIASelectableIfDefined,

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

@ -1283,12 +1283,11 @@ void Accessible::ApplyARIAState(uint64_t* aState) const {
aria::MapToState(roleMapEntry->attributeMap3, element, aState))
aria::MapToState(roleMapEntry->attributeMap4, element, aState);
// ARIA gridcell inherits editable/readonly states from the grid until it's
// overridden.
// ARIA gridcell inherits readonly state from the grid until it's overridden.
if ((roleMapEntry->Is(nsGkAtoms::gridcell) ||
roleMapEntry->Is(nsGkAtoms::columnheader) ||
roleMapEntry->Is(nsGkAtoms::rowheader)) &&
!(*aState & (states::READONLY | states::EDITABLE))) {
!nsAccUtils::HasDefinedARIAToken(mContent, nsGkAtoms::aria_readonly)) {
const TableCellAccessible* cell = AsTableCell();
if (cell) {
TableAccessible* table = cell->Table();
@ -1296,7 +1295,7 @@ void Accessible::ApplyARIAState(uint64_t* aState) const {
Accessible* grid = table->AsAccessible();
uint64_t gridState = 0;
grid->ApplyARIAState(&gridState);
*aState |= (gridState & (states::READONLY | states::EDITABLE));
*aState |= gridState & states::READONLY;
}
}
}

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

@ -117,67 +117,67 @@
// aria-readonly
testStates("aria_readonly_textbox", STATE_READONLY);
// readonly/editable on grid and gridcell
testStates("aria_grid_default", 0, EXT_STATE_EDITABLE,
// readonly on grid and gridcell
testStates("aria_grid_default", 0, 0,
STATE_READONLY, 0);
testStates("aria_grid_default_colheader_readonly", STATE_READONLY, 0,
0, EXT_STATE_EDITABLE);
testStates("aria_grid_default_colheader_inherited", 0, EXT_STATE_EDITABLE,
0, 0);
testStates("aria_grid_default_colheader_inherited", 0, 0,
STATE_READONLY, 0);
testStates("aria_grid_default_rowheader_readonly", STATE_READONLY, 0,
0, EXT_STATE_EDITABLE);
testStates("aria_grid_default_rowheader_inherited", 0, EXT_STATE_EDITABLE,
0, 0);
testStates("aria_grid_default_rowheader_inherited", 0, 0,
STATE_READONLY, 0);
testStates("aria_grid_default_cell_readonly", STATE_READONLY, 0,
0, EXT_STATE_EDITABLE);
testStates("aria_grid_default_cell_inherited", 0, EXT_STATE_EDITABLE,
0, 0);
testStates("aria_grid_default_cell_inherited", 0, 0,
STATE_READONLY, 0);
testStates("aria_grid_readonly", STATE_READONLY, 0,
0, EXT_STATE_EDITABLE);
testStates("aria_grid_readonly_colheader_editable", 0, EXT_STATE_EDITABLE,
0, 0);
testStates("aria_grid_readonly_colheader_editable", 0, 0,
STATE_READONLY, 0);
testStates("aria_grid_readonly_colheader_inherited", STATE_READONLY, 0,
0, EXT_STATE_EDITABLE);
testStates("aria_grid_readonly_rowheader_editable", 0, EXT_STATE_EDITABLE,
0, 0);
testStates("aria_grid_readonly_rowheader_editable", 0, 0,
STATE_READONLY, 0);
testStates("aria_grid_readonly_rowheader_inherited", STATE_READONLY, 0,
0, EXT_STATE_EDITABLE);
testStates("aria_grid_readonly_cell_editable", 0, EXT_STATE_EDITABLE,
0, 0);
testStates("aria_grid_readonly_cell_editable", 0, 0,
STATE_READONLY, 0);
testStates("aria_grid_readonly_cell_inherited", STATE_READONLY, 0,
0, EXT_STATE_EDITABLE);
0, 0);
// readonly/editable on treegrid and gridcell
testStates("aria_treegrid_default", 0, EXT_STATE_EDITABLE,
// readonly on treegrid and gridcell
testStates("aria_treegrid_default", 0, 0,
STATE_READONLY, 0);
testStates("aria_treegrid_default_colheader_readonly", STATE_READONLY, 0,
0, EXT_STATE_EDITABLE);
testStates("aria_treegrid_default_colheader_inherited", 0, EXT_STATE_EDITABLE,
0, 0);
testStates("aria_treegrid_default_colheader_inherited", 0, 0,
STATE_READONLY, 0);
testStates("aria_treegrid_default_rowheader_readonly", STATE_READONLY, 0,
0, EXT_STATE_EDITABLE);
testStates("aria_treegrid_default_rowheader_inherited", 0, EXT_STATE_EDITABLE,
0, 0);
testStates("aria_treegrid_default_rowheader_inherited", 0, 0,
STATE_READONLY, 0);
testStates("aria_treegrid_default_cell_readonly", STATE_READONLY, 0,
0, EXT_STATE_EDITABLE);
testStates("aria_treegrid_default_cell_inherited", 0, EXT_STATE_EDITABLE,
0, 0);
testStates("aria_treegrid_default_cell_inherited", 0, 0,
STATE_READONLY, 0);
testStates("aria_treegrid_readonly", STATE_READONLY, 0,
0, EXT_STATE_EDITABLE);
testStates("aria_treegrid_readonly_colheader_editable", 0, EXT_STATE_EDITABLE,
0, 0);
testStates("aria_treegrid_readonly_colheader_editable", 0, 0,
STATE_READONLY, 0);
testStates("aria_treegrid_readonly_colheader_inherited", STATE_READONLY, 0,
0, EXT_STATE_EDITABLE);
testStates("aria_treegrid_readonly_rowheader_editable", 0, EXT_STATE_EDITABLE,
0, 0);
testStates("aria_treegrid_readonly_rowheader_editable", 0, 0,
STATE_READONLY, 0);
testStates("aria_treegrid_readonly_rowheader_inherited", STATE_READONLY, 0,
0, EXT_STATE_EDITABLE);
testStates("aria_treegrid_readonly_cell_editable", 0, EXT_STATE_EDITABLE,
0, 0);
testStates("aria_treegrid_readonly_cell_editable", 0, 0,
STATE_READONLY, 0);
testStates("aria_treegrid_readonly_cell_inherited", STATE_READONLY, 0,
0, EXT_STATE_EDITABLE);
0, 0);
// aria-readonly on directory
testStates("aria_directory", STATE_READONLY);