Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
<?xml version="1.0"?>
type="text/css"?>
title="Accessible XUL button hierarchy tests">
<script type="application/javascript"
src="../common.js" />
<script type="application/javascript"
src="../role.js" />
<script type="application/javascript"
src="../events.js" />
<script type="application/javascript">
<![CDATA[
const {AppConstants} = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
async function doTest() {
// openMenu("button1")
let button1Acc = getAccessible("button1");
let menupopup1 = button1Acc.firstChild;
testAccessibleTree(button1Acc, { PUSHBUTTON: [{ MENUPOPUP: [] }] });
let reordered = waitForEvent(EVENT_REORDER, menupopup1);
synthesizeMouse(getNode("button1"), 1, 1, {});
await reordered;
testAccessibleTree(button1Acc, { PUSHBUTTON: [{ MENUPOPUP: [
{ role: ROLE_MENUITEM, children: [] },
{ role: ROLE_MENUITEM, children: [] }
] }] });
synthesizeKey("KEY_Escape");
// openMenu("button3")
let button3Acc = getAccessible("button3");
let menupopup3 = button3Acc.firstChild;
testAccessibleTree(button3Acc, { PUSHBUTTON: [{ MENUPOPUP: [] }] });
reordered = waitForEvent(EVENT_REORDER, menupopup3);
synthesizeMouse(getNode("button3"), 1, 1, {});
await reordered;
testAccessibleTree(button3Acc, { PUSHBUTTON: [{ MENUPOPUP: [
{ role: ROLE_MENUITEM, children: [] },
{ role: ROLE_MENUITEM, children: [] }
] }] });
synthesizeKey("KEY_Escape");
const columnPickerBtn =
getAccessible("tree").firstChild.lastChild.previousSibling;
if (!(
AppConstants.platform == "macosx" &&
Services.prefs.getBoolPref("widget.macos.native-anchored-menus", false))
) {
// The column picker is always native, and menus are intentionally
// hidden from accessibility events
let menupopupCP = columnPickerBtn.nextSibling;
testAccessibleTree(columnPickerBtn, { PUSHBUTTON: [] });
reordered = waitForEvent(EVENT_REORDER, menupopupCP);
synthesizeMouse(getNode(columnPickerBtn), 1, 1, {});
await reordered;
testAccessibleTree(columnPickerBtn, { PUSHBUTTON: [] });
testAccessibleTree(menupopupCP, { MENUPOPUP: [
{ role: ROLE_CHECK_MENU_ITEM, children: [] },
{ role: ROLE_CHECK_MENU_ITEM, children: [] }
] });
synthesizeKey("KEY_Escape");
}
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
]]>
</script>
<hbox flex="1" style="overflow: auto;">
<a target="_blank"
title="Ensure accessible children for toolbarbutton types 'menu'">
</a>
<a target="_blank"
title="Don't force accessible creation for popup children">
</a>
<a target="_blank"
title="Column header selection popup no longer exposed to accessibility APIs">
</a>
<br/>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<vbox flex="1">
<button id="button1" type="menu" label="button">
<menupopup nonnative="">
<menuitem label="menuitem"/>
<menuitem label="menuitem"/>
</menupopup>
</button>
<toolbarbutton id="button3" type="menu" label="toolbarbutton">
<menupopup nonnative="">
<menuitem label="menuitem"/>
<menuitem label="menuitem"/>
</menupopup>
</toolbarbutton>
<tree id="tree" flex="1">
<treecols>
<treecol id="col" flex="1" primary="true" label="column"/>
<treecol id="col2" flex="1" label="another column"/>
</treecols>
<treechildren/>
</tree>
</vbox>
</hbox>
</window>