зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1848909: Add a11y support for XUL toolbarbuttons labelled by a text leaf. r=eeejay
Normally, XUL toolbarbutton elements are labelled using the label attribute or a child label element. However, there are some instances such as in the Synced Tabs menu where a toolbarbutton contains only a text leaf. Previously, these buttons exposed no label to accessibility APIs. To fix this, we now allow a text leaf child in the accessibility tree. We already supported this for XUL button elements. Also, there was a bunch of existing common code in IsAcceptableChild for XULToolbarbuttonAccessible and XULButtonAccessible and the former subclasses the latter. Therefore, XULToolbarbuttonAccessible::IsAcceptableChild has been refactored to call the base class method, adding an additional check specific to toolbarbuttons. Differential Revision: https://phabricator.services.mozilla.com/D191713
This commit is contained in:
Родитель
8fe0f11ad9
Коммит
5d6cbfc643
|
@ -133,6 +133,7 @@
|
|||
|
||||
// Button labelled by a text child.
|
||||
testName("button_text", "Text");
|
||||
testName("toolbarbutton_text", "Text");
|
||||
|
||||
// ARIA role option is presented allowing the name calculation from
|
||||
// the visible children (bug 443081)
|
||||
|
@ -303,6 +304,7 @@
|
|||
<!-- name from children -->
|
||||
<box id="box_children" role="button">14</box>
|
||||
<button id="button_text">Text</button>
|
||||
<toolbarbutton id="toolbarbutton_text">Text</toolbarbutton>
|
||||
|
||||
<!-- name from children, hidden children -->
|
||||
<vbox role="listbox" tabindex="0">
|
||||
|
|
|
@ -406,12 +406,10 @@ bool XULToolbarButtonAccessible::IsSeparator(LocalAccessible* aAccessible) {
|
|||
// XULToolbarButtonAccessible: Widgets
|
||||
|
||||
bool XULToolbarButtonAccessible::IsAcceptableChild(nsIContent* aEl) const {
|
||||
// In general XUL button has not accessible children. Nevertheless menu
|
||||
// buttons can have popup accessibles (@type="menu" or columnpicker).
|
||||
// Also: Toolbar buttons can have labels as children.
|
||||
// But only if the label attribute is not present.
|
||||
return aEl->IsXULElement(nsGkAtoms::menupopup) ||
|
||||
aEl->IsXULElement(nsGkAtoms::popup) ||
|
||||
return XULButtonAccessible::IsAcceptableChild(aEl) ||
|
||||
// In addition to the children allowed by buttons, toolbarbuttons can
|
||||
// have labels as children, but only if the label attribute is not
|
||||
// present.
|
||||
(aEl->IsXULElement(nsGkAtoms::label) &&
|
||||
!mContent->AsElement()->HasAttr(nsGkAtoms::label));
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче