Bug 1676878: Modify moxLabel to not strip first character for outlines r=eeejay

Differential Revision: https://phabricator.services.mozilla.com/D96895
This commit is contained in:
Morgan Reschenberg 2020-11-12 23:40:02 +00:00
Родитель 86118b9f7a
Коммит dbc30ace84
2 изменённых файлов: 39 добавлений и 7 удалений

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

@ -554,8 +554,12 @@ using namespace mozilla::a11y;
} else {
mGeckoAccessible.AsProxy()->Name(title);
}
// remove listmarker for clean label
return nsCocoaUtils::ToNSString(Substring(title, 1, title.Length()));
// XXX: When parsing outlines built with ul/lu's, we
// include the bullet in this description even
// though webkit doesn't. Not all outlines are built with
// ul/lu's so we can't strip the first character here.
return nsCocoaUtils::ToNSString(title);
}
@end

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

@ -242,11 +242,6 @@ addAccessibleTask(
is(outChildren[1].getAttributeValue("AXSubrole"), "AXOutlineRow");
const outRows = outline.getAttributeValue("AXRows");
for (let i = 0; i < outRows.length; i++) {
console.log(i);
console.log(outRows[i].getAttributeValue("AXDescription"));
console.log("\n");
}
is(outRows.length, 9, "Outline has nine rows");
is(
outRows[0].getAttributeValue("AXDisclosing"),
@ -374,3 +369,36 @@ addAccessibleTask(
);
}
);
// Test outline that isn't built with li/uls gets correct desc
addAccessibleTask(
`
<div role="tree" id="tree" tabindex="0" aria-label="My drive" aria-activedescendant="myfiles">
<div id="myfiles" role="treeitem" aria-label="My files" aria-selected="true" aria-expanded="false">My files</div>
<div role="treeitem" aria-label="Shared items" aria-selected="false" aria-expanded="false">Shared items</div>
</div>
`,
async (browser, accDoc) => {
const tree = getNativeInterface(accDoc, "tree");
is(tree.getAttributeValue("AXRole"), "AXOutline", "Correct role for tree");
const treeItems = tree.getAttributeValue("AXChildren");
is(treeItems.length, 2, "Outline has two direct children");
is(treeItems[0].getAttributeValue("AXSubrole"), "AXOutlineRow");
is(treeItems[1].getAttributeValue("AXSubrole"), "AXOutlineRow");
const outRows = tree.getAttributeValue("AXRows");
is(outRows.length, 2, "Outline has two rows");
is(
outRows[0].getAttributeValue("AXDescription"),
"My files",
"files labelled correctly"
);
is(
outRows[1].getAttributeValue("AXDescription"),
"Shared items",
"shared items labelled correctly"
);
}
);