Bug 1696309 - Don't skip aria-owned children early in TreeWalker. r=Jamie

This causes problems when the aria-owns is invalid, for example in a
cyclical link. The reason this was put in in the first place is not
documented or apparent, but maybe a way to reduce churn.

This also fixes an existing test and makes the lineage of a cyclical
aria-owns elements match what chrome does.
(t3_1, t3_2, heading, t3_3).

Differential Revision: https://phabricator.services.mozilla.com/D221276
This commit is contained in:
Eitan Isaacson 2024-09-08 04:04:17 +00:00
Родитель 0224104286
Коммит 0386e3e475
2 изменённых файлов: 26 добавлений и 16 удалений

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

@ -324,17 +324,7 @@ LocalAccessible* TreeWalker::AccessibleFor(nsIContent* aNode, uint32_t aFlags,
// Create an accessible if allowed.
if (!(aFlags & eWalkCache) && mContext->IsAcceptableChild(aNode)) {
// We may have ARIA owned element in the dependent attributes map, but the
// element may be not allowed for this ARIA owns relation, if the relation
// crosses out XBL anonymous content boundaries. In this case we won't
// create an accessible object for it, when aria-owns is processed, which
// may make the element subtree inaccessible. To avoid that let's create
// an accessible object now, and later, if allowed, move it in the tree,
// when aria-owns relation is processed.
if (mDoc->RelocateARIAOwnedIfNeeded(aNode) && !aNode->IsXULElement()) {
*aSkipSubtree = true;
return nullptr;
}
mDoc->RelocateARIAOwnedIfNeeded(aNode);
return GetAccService()->CreateAccessible(aNode, mContext, aSkipSubtree);
}

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

@ -43,16 +43,16 @@
testAccessibleTree("t2_1", tree);
tree =
{ SECTION: [ // t3_3
{ GROUPING: [ // t3_1
{ NOTE: [ // t3_2
{ HEADING: [ // DOM child of t3_2
{ GROUPING: [ // t3_1
{ NOTE: [ // t3_2
{ HEADING: [ // DOM child of t3_2
{ SECTION: [ // t3_3
// no kids, no loop
] },
] },
] },
] };
testAccessibleTree("t3_3", tree);
testAccessibleTree("t3_1", tree);
tree =
{ SECTION: [ // t4_1
@ -122,6 +122,17 @@
] };
testAccessibleTree("presentation_owner", tree);
tree =
{ GROUPING: [ // t7
{ SECTION: [ // t7_1
{ SECTION: [ // t7_2
{ SECTION: [ { TEXT_LEAF: [] } ] },
] },
] },
{ role: ROLE_PUSHBUTTON, name: "heck yes" },
] };
testAccessibleTree("t7", tree);
SimpleTest.finish();
}
@ -192,6 +203,15 @@
<div id="presentation" role="presentation">
<div id="presentation_owner" aria-owns="presentation"></div>
</div>
<div id="t7" role="group">
<div id="t7_1" role="presentation">
<div id="t7_2" role="presentation">
<div aria-owns="t7_2">heck yes</div>
</div>
</div>
<div role="button" aria-labelledby="t7_1"></div>
</div>
</body>
</html>