Bug 1703169: Support XUL buttons labelled by text children. r=morgan

Previously, text children were excluded from the a11y tree, so they weren't considered when computing name from subtree.

Differential Revision: https://phabricator.services.mozilla.com/D111029
This commit is contained in:
James Teh 2021-04-08 22:59:43 +00:00
Родитель cc19c08fbf
Коммит 1e3921cd84
2 изменённых файлов: 14 добавлений и 4 удалений

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

@ -131,6 +131,9 @@
// children.
testName("box_children", "14");
// Button labelled by a text child.
testName("button_text", "Text");
// ARIA role option is presented allowing the name calculation from
// the visible children (bug 443081)
testName("lb_opt1_children_hidden", "i am visible");
@ -299,6 +302,7 @@
<!-- name from children -->
<box id="box_children" role="button">14</box>
<button id="button_text">Text</button>
<!-- name from children, hidden children -->
<vbox role="listbox" tabindex="0">

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

@ -125,10 +125,16 @@ LocalAccessible* XULButtonAccessible::ContainerWidget() const {
}
bool XULButtonAccessible::IsAcceptableChild(nsIContent* aEl) const {
// In general XUL button has not accessible children. Nevertheless menu
// buttons can have popup accessibles (@type="menu" or columnpicker).
return aEl->IsXULElement(nsGkAtoms::menupopup) ||
aEl->IsXULElement(nsGkAtoms::popup);
// In general XUL buttons should not have accessible children. However:
return
// menu buttons can have popup accessibles (@type="menu" or
// columnpicker).
aEl->IsXULElement(nsGkAtoms::menupopup) ||
aEl->IsXULElement(nsGkAtoms::popup) ||
// A XUL button can be labelled by a child text node, so we need to allow
// that as a child so it will be picked up when computing name from
// subtree.
aEl->IsText();
}
////////////////////////////////////////////////////////////////////////////////