mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 559766 - add accessibility support for @list on HTML input and for HTML datalist, r=marcoz
This commit is contained in:
parent
88ce26fac5
commit
bca073dbec
@ -511,6 +511,10 @@ nsHTMLTextFieldAccessible::NativeState()
|
||||
return state;
|
||||
}
|
||||
|
||||
// Expose autocomplete state if it has associated autocomplete list.
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::list))
|
||||
return state | states::SUPPORTS_AUTOCOMPLETION;
|
||||
|
||||
// No parent can mean a fake widget created for XUL textbox. If accessible
|
||||
// is unattached from tree then we don't care.
|
||||
if (mParent && gIsFormFillEnabled) {
|
||||
|
@ -73,7 +73,7 @@
|
||||
|
||||
this.invoke = function initFormAutoCompleteBy_invoke()
|
||||
{
|
||||
var iframeDOMDoc = getFormAutoCompleteDOMDoc(aIFrameID);
|
||||
var iframeDOMDoc = getIFrameDOMDoc(aIFrameID);
|
||||
|
||||
var inputNode = iframeDOMDoc.getElementById("input");
|
||||
inputNode.value = aAutoCompleteValue;
|
||||
@ -87,6 +87,30 @@
|
||||
}
|
||||
}
|
||||
|
||||
function loadHTML5ListAutoComplete(aIFrameID)
|
||||
{
|
||||
this.iframeNode = getNode(aIFrameID);
|
||||
this.iframe = getAccessible(aIFrameID);
|
||||
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_REORDER, this.iframe)
|
||||
];
|
||||
|
||||
this.invoke = function loadHTML5ListAutoComplete_invoke()
|
||||
{
|
||||
var url = "data:text/html,<html><body>" +
|
||||
"<datalist id='cities'><option>hello</option><option>hi</option></datalist>" +
|
||||
"<input id='input' list='cities'>" +
|
||||
"</body></html>";
|
||||
this.iframeNode.setAttribute("src", url);
|
||||
}
|
||||
|
||||
this.getID = function loadHTML5ListAutoComplete_getID()
|
||||
{
|
||||
return "load HTML5 list autocomplete page";
|
||||
}
|
||||
}
|
||||
|
||||
function removeChar(aID, aCheckerOrEventSeq)
|
||||
{
|
||||
this.__proto__ = new synthAction(aID, aCheckerOrEventSeq);
|
||||
@ -279,7 +303,7 @@
|
||||
this.index = aIdx;
|
||||
}
|
||||
|
||||
function getFormAutoCompleteDOMDoc(aIFrameID)
|
||||
function getIFrameDOMDoc(aIFrameID)
|
||||
{
|
||||
return getNode(aIFrameID).contentDocument;
|
||||
}
|
||||
@ -362,6 +386,7 @@
|
||||
gInitQueue.push(new loadFormAutoComplete("iframe"));
|
||||
gInitQueue.push(new initFormAutoCompleteBy("iframe", "hello"));
|
||||
gInitQueue.push(new initFormAutoCompleteBy("iframe", "hi"));
|
||||
gInitQueue.push(new loadHTML5ListAutoComplete("iframe2"));
|
||||
gInitQueue.onFinish = function initQueue_onFinish()
|
||||
{
|
||||
SimpleTest.executeSoon(doTests);
|
||||
@ -386,7 +411,11 @@
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// HTML form autocomplete tests
|
||||
queueAutoCompleteTests(getFormAutoCompleteDOMDoc("iframe").getElementById("input"));
|
||||
queueAutoCompleteTests(getIFrameDOMDoc("iframe").getElementById("input"));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// HTML5 list autocomplete tests
|
||||
queueAutoCompleteTests(getIFrameDOMDoc("iframe2").getElementById("input"));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// searchbar tests
|
||||
@ -438,6 +467,11 @@
|
||||
title="Rework accessible focus handling">
|
||||
Mozilla Bug 673958
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=559766"
|
||||
title="Add accessibility support for @list on HTML input and for HTML datalist">
|
||||
Mozilla Bug 559766
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
@ -455,6 +489,8 @@
|
||||
|
||||
<iframe id="iframe"/>
|
||||
|
||||
<iframe id="iframe2"/>
|
||||
|
||||
<searchbar id="searchbar"/>
|
||||
|
||||
<vbox id="eventdump"/>
|
||||
|
@ -65,6 +65,12 @@
|
||||
testStates(invalid[i] + "2", 0, 0, STATE_INVALID);
|
||||
}
|
||||
|
||||
// autocomplete states
|
||||
testStates("autocomplete-default", 0, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
|
||||
testStates("autocomplete-off", 0, 0, 0, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
|
||||
testStates("autocomplete-formoff", 0, 0, 0, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
|
||||
testStates("autocomplete-list", 0, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
|
||||
testStates("autocomplete-list2", 0, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
@ -99,6 +105,11 @@
|
||||
title="Expose intrinsic invalid state to accessibility API">
|
||||
Mozilla Bug 601205
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=559766"
|
||||
title="Add accessibility support for @list on HTML input and for HTML datalist">
|
||||
Mozilla Bug 559766
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
@ -155,5 +166,18 @@
|
||||
<input id="url" type="url" value="foo">
|
||||
<input id="url2" type="url" value="http://mozilla.org/">
|
||||
|
||||
<!-- autocomplete -->
|
||||
<input id="autocomplete-default">
|
||||
<input id="autocomplete-off" autocomplete="off">
|
||||
<form autocomplete="off">
|
||||
<input id="autocomplete-formoff">
|
||||
</form>
|
||||
<datalist id="cities">
|
||||
<option>Paris</option>
|
||||
<option>San Francisco</option>
|
||||
</datalist>
|
||||
<input id="autocomplete-list" list="cities">
|
||||
<input id="autocomplete-list2" list="cities" autocomplete="off">
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user