Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Errors
- This test failed 2 times in the preceding 30 days. quicksearch this test
- Manifest: accessible/tests/mochitest/events/a11y.toml
<?xml version="1.0"?>
type="text/css"?>
title="Accessible focus event testing">
<script type="application/javascript"
src="../common.js" />
<script type="application/javascript"
src="../role.js" />
<script type="application/javascript"
src="../states.js" />
<script type="application/javascript"
src="../events.js" />
<script type="application/javascript">
//gA11yEventDumpID = "eventdump"; // debug stuff
//gA11yEventDumpToConsole = true; // debug stuff
var gQueue = null;
function doTests()
{
// Test focus events.
gQueue = new eventQueue();
gQueue.push(new synthFocus("textbox",
new focusChecker(getNode("textbox"))));
gQueue.push(new synthFocusOnFrame("editabledoc"));
gQueue.push(new synthFocus("radioclothes",
new focusChecker("radiosweater")));
gQueue.push(new synthDownKey("radiosweater",
new focusChecker("radiojacket")));
gQueue.push(new synthFocus("checkbox"));
gQueue.push(new synthFocus("button"));
gQueue.push(new synthFocus("checkbutton"));
gQueue.push(new synthFocus("radiobutton"));
// focus menubutton
gQueue.push(new synthFocus("menubutton"));
// click menubutton, open popup, focus stays on menu button
gQueue.push(new synthClick("menubutton", new nofocusChecker()));
// select first menu item ("item 1"), focus on menu item
gQueue.push(new synthDownKey("menubutton", new focusChecker("mb_item1")));
// choose select menu item, focus gets back to menubutton
gQueue.push(new synthEnterKey("mb_item1", new focusChecker("menubutton")));
// press enter to open popup, focus stays on menubutton
gQueue.push(new synthEnterKey("menubutton", new nofocusChecker()));
// select second menu item ("item 2"), focus on menu item
gQueue.push(new synthUpKey("menubutton", new focusChecker("mb_item2")));
// close the popup
gQueue.push(new synthEscapeKey("menubutton", new focusChecker("menubutton")));
// clicking on button having associated popup doesn't change focus
gQueue.push(new synthClick("popupbutton", [
new nofocusChecker(),
new invokerChecker("popupshown", "backpopup")
]));
// select first menu item ("item 1"), focus on menu item
gQueue.push(new synthDownKey("popupbutton", new focusChecker("bp_item1")));
// choose select menu item, focus gets back to menubutton
gQueue.push(new synthEnterKey("bp_item1", new focusChecker("menubutton")));
// show popup again for the next test
gQueue.push(new synthClick("popupbutton", new nofocusChecker()));
gQueue.invoke(); // Will call SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTests);
</script>
<hbox flex="1" style="overflow: auto;">
<a target="_blank"
title=" fire focus event on document accessible whenever the root or body element is focused">
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
</body>
<vbox flex="1">
<html:input id="textbox" value="hello"/>
<iframe id="editabledoc" src="focus.html"/>
<radiogroup id="radioclothes">
<radio id="radiosweater" label="radiosweater"/>
<radio id="radiocap" label="radiocap" disabled="true"/>
<radio id="radiojacket" label="radiojacket"/>
</radiogroup>
<checkbox id="checkbox" label="checkbox"/>
<button id="button" label="button"/>
<button id="menubutton" type="menu" label="menubutton">
<menupopup>
<menuitem id="mb_item1" label="item1"/>
<menuitem id="mb_item2" label="item2"/>
</menupopup>
</button>
<button id="checkbutton" type="checkbox" label="checkbutton"/>
<button id="radiobutton" type="radio" group="rbgroup" label="radio1"/>
<popupset>
<menupopup id="backpopup" position="after_start">
<menuitem id="bp_item1" label="Page 1"/>
<menuitem id="bp_item2" label="Page 2"/>
</menupopup>
</popupset>
<button id="popupbutton" label="Pop Me Up" popup="backpopup"/>
<vbox id="eventdump"/>
</vbox>
</hbox>
</window>