2009-10-06 00:50:47 -07:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<title>Accessible focus testing</title>
|
|
|
|
|
|
|
|
<link rel="stylesheet" type="text/css"
|
|
|
|
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
|
|
|
|
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
|
|
|
|
|
|
|
<script type="application/javascript"
|
2010-09-01 15:09:56 -07:00
|
|
|
src="../common.js"></script>
|
2009-10-06 00:50:47 -07:00
|
|
|
<script type="application/javascript"
|
2010-09-01 15:09:56 -07:00
|
|
|
src="../events.js"></script>
|
2009-10-06 00:50:47 -07:00
|
|
|
|
|
|
|
<script type="application/javascript">
|
2010-03-12 20:24:51 -08:00
|
|
|
function openCloseDialog(aID)
|
2009-10-06 00:50:47 -07:00
|
|
|
{
|
2010-03-12 20:24:51 -08:00
|
|
|
this.DOMNode = getNode(aID);
|
|
|
|
|
|
|
|
this.invoke = function openCloseDialog_invoke()
|
2009-10-06 00:50:47 -07:00
|
|
|
{
|
2010-03-12 23:51:15 -08:00
|
|
|
var wnd = window.open("focus.html");
|
2010-03-12 20:24:51 -08:00
|
|
|
wnd.close();
|
2009-10-06 00:50:47 -07:00
|
|
|
}
|
|
|
|
|
2010-03-12 20:24:51 -08:00
|
|
|
this.getID = function openCloseDialog_getID()
|
|
|
|
{
|
|
|
|
return "Open close dialog on " + prettyName(aID);
|
|
|
|
}
|
|
|
|
}
|
2009-10-06 00:50:47 -07:00
|
|
|
|
2010-03-17 00:10:52 -07:00
|
|
|
function focusElmWhileSubdocIsFocused(aID)
|
|
|
|
{
|
|
|
|
this.DOMNode = getNode(aID);
|
|
|
|
|
|
|
|
this.invoke = function focusElmWhileSubdocIsFocused_invoke()
|
|
|
|
{
|
|
|
|
this.DOMNode.focus();
|
|
|
|
}
|
|
|
|
|
|
|
|
this.eventSeq = [
|
|
|
|
new invokerChecker(EVENT_FOCUS, this.DOMNode)
|
|
|
|
];
|
|
|
|
|
|
|
|
this.unexpectedEventSeq = [
|
|
|
|
new invokerChecker(EVENT_FOCUS, this.DOMNode.ownerDocument)
|
|
|
|
];
|
|
|
|
|
|
|
|
this.getID = function focusElmWhileSubdocIsFocused_getID()
|
|
|
|
{
|
|
|
|
return "Focus element while subdocument is focused " + prettyName(aID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-20 21:16:10 -07:00
|
|
|
function showNFocusAlertDialog()
|
|
|
|
{
|
|
|
|
this.ID = "alertdialog";
|
|
|
|
this.DOMNode = getNode(this.ID);
|
|
|
|
|
|
|
|
this.invoke = function showNFocusAlertDialog_invoke()
|
|
|
|
{
|
|
|
|
document.getElementById(this.ID).style.display = 'block';
|
|
|
|
document.getElementById(this.ID).focus();
|
|
|
|
}
|
|
|
|
|
|
|
|
this.eventSeq = [
|
2010-12-13 14:06:34 -08:00
|
|
|
new invokerChecker(EVENT_SHOW, this.DOMNode),
|
|
|
|
new invokerChecker(EVENT_FOCUS, this.DOMNode)
|
2010-10-20 21:16:10 -07:00
|
|
|
];
|
|
|
|
|
|
|
|
this.getID = function showNFocusAlertDialog_getID()
|
|
|
|
{
|
|
|
|
return "Show and focus alert dialog " + prettyName(this.ID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-06 00:50:47 -07:00
|
|
|
/**
|
|
|
|
* Do tests.
|
|
|
|
*/
|
|
|
|
|
2010-10-20 21:16:10 -07:00
|
|
|
//gA11yEventDumpID = "eventdump"; // debug stuff
|
2009-10-06 00:50:47 -07:00
|
|
|
|
|
|
|
var gQueue = null;
|
|
|
|
|
|
|
|
function doTests()
|
|
|
|
{
|
2010-03-17 00:10:52 -07:00
|
|
|
gQueue = new eventQueue(EVENT_FOCUS);
|
2009-10-06 00:50:47 -07:00
|
|
|
|
2010-03-12 20:24:51 -08:00
|
|
|
gQueue.push(new synthFocus("editablearea"));
|
|
|
|
gQueue.push(new synthFocus("textbox"));
|
2009-10-06 00:50:47 -07:00
|
|
|
|
2010-03-12 20:24:51 -08:00
|
|
|
gQueue.push(new synthFocus("button"));
|
|
|
|
gQueue.push(new openCloseDialog("button"));
|
2009-10-06 00:50:47 -07:00
|
|
|
|
2010-03-12 20:24:51 -08:00
|
|
|
var frameNode = getNode("editabledoc");
|
2010-03-17 22:44:57 -07:00
|
|
|
gQueue.push(new synthFocusOnFrame(frameNode));
|
2010-03-13 04:10:33 -08:00
|
|
|
gQueue.push(new openCloseDialog(frameNode.contentDocument));
|
2009-10-06 00:50:47 -07:00
|
|
|
|
2010-03-17 00:10:52 -07:00
|
|
|
gQueue.push(new focusElmWhileSubdocIsFocused("button"));
|
|
|
|
|
2010-10-20 21:16:10 -07:00
|
|
|
gQueue.push(new showNFocusAlertDialog());
|
|
|
|
|
2009-10-06 00:50:47 -07:00
|
|
|
gQueue.invoke(); // Will call SimpleTest.finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
addA11yLoadEvent(doTests);
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<a target="_blank"
|
2010-03-12 20:24:51 -08:00
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=551679"
|
|
|
|
title="focus is not fired for focused document when switching between windows">
|
|
|
|
Mozilla Bug 551679
|
2009-10-06 00:50:47 -07:00
|
|
|
</a>
|
2010-03-17 00:10:52 -07:00
|
|
|
<a target="_blank"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=352220"
|
|
|
|
title=" Inconsistent focus events when returning to a document frame">
|
|
|
|
Mozilla Bug 352220
|
|
|
|
</a>
|
2010-10-20 21:16:10 -07:00
|
|
|
<a target="_blank"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=580464"
|
|
|
|
title="Accessible focus incorrect after JS focus() but correct after switching apps or using menu bar">
|
|
|
|
Mozilla Bug 580464
|
|
|
|
</a>
|
2009-10-06 00:50:47 -07:00
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none"></div>
|
|
|
|
<pre id="test">
|
|
|
|
</pre>
|
|
|
|
|
2010-03-12 20:24:51 -08:00
|
|
|
<div id="editablearea" contentEditable="true">editable area</div>
|
2009-10-06 00:50:47 -07:00
|
|
|
<input id="textbox">
|
2010-03-12 20:24:51 -08:00
|
|
|
<button id="button">button</button>
|
|
|
|
<iframe id="editabledoc" src="focus.html"></iframe>
|
2009-10-06 00:50:47 -07:00
|
|
|
|
2010-10-20 21:16:10 -07:00
|
|
|
<div id="alertdialog" style="display: none" tabindex="-1" role="alertdialog" aria-labelledby="title2" aria-describedby="desc2">
|
|
|
|
<div id="title2">Blah blah</div>
|
|
|
|
<div id="desc2">Woof woof woof.</div>
|
|
|
|
<button>Close</button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
2009-10-06 00:50:47 -07:00
|
|
|
<div id="eventdump"></div>
|
|
|
|
</body>
|
|
|
|
</html>
|