Bug 237249. Accessible Name, role and value of URL bar and search field broken. r=pkwarren on accessibility module, r=mconnor for toolkit changes, r+sr=Neil for xpfe changes, sr=bryner for accessibility module changes, a=dveditz
git-svn-id: svn://10.0.0.236/trunk@169102 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -78,6 +78,7 @@ ACCESSIBILITY_ATOM(optgroup, "optgroup")
|
||||
ACCESSIBILITY_ATOM(option, "option")
|
||||
ACCESSIBILITY_ATOM(q, "q")
|
||||
ACCESSIBILITY_ATOM(select, "select")
|
||||
ACCESSIBILITY_ATOM(toolbaritem, "toolbaritem")
|
||||
ACCESSIBILITY_ATOM(ul, "ul")
|
||||
|
||||
// Alphabetical list of attributes
|
||||
@@ -89,6 +90,7 @@ ACCESSIBILITY_ATOM(id, "id")
|
||||
ACCESSIBILITY_ATOM(name, "name")
|
||||
ACCESSIBILITY_ATOM(tabindex, "tabindex")
|
||||
ACCESSIBILITY_ATOM(title, "title")
|
||||
ACCESSIBILITY_ATOM(tooltiptext, "tooltiptext")
|
||||
|
||||
// DHTML accessibility attributes
|
||||
ACCESSIBILITY_ATOM(valuenow, "valuenow") // For DHTML widget values
|
||||
|
||||
@@ -973,13 +973,8 @@ nsresult nsAccessible::AppendStringWithSpaces(nsAString *aFlatString, const nsAS
|
||||
nsresult nsAccessible::AppendFlatStringFromContentNode(nsIContent *aContent, nsAString *aFlatString)
|
||||
{
|
||||
nsAutoString textEquivalent;
|
||||
nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(aContent));
|
||||
if (xulElement) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aContent));
|
||||
NS_ASSERTION(elt, "No DOM element for content node!");
|
||||
elt->GetAttribute(NS_LITERAL_STRING("value"), textEquivalent); // Prefer value over tooltiptext
|
||||
if (textEquivalent.IsEmpty())
|
||||
elt->GetAttribute(NS_LITERAL_STRING("tooltiptext"), textEquivalent);
|
||||
if (aContent->IsContentOfType(nsIContent::eXUL)) {
|
||||
aContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::tooltiptext, textEquivalent);
|
||||
textEquivalent.CompressWhitespace();
|
||||
return AppendStringWithSpaces(aFlatString, textEquivalent);
|
||||
}
|
||||
@@ -1298,14 +1293,28 @@ nsresult nsAccessible::GetXULName(nsAString& aLabel, PRBool aCanAggregateSubtree
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!aCanAggregateSubtree) {
|
||||
// Don't use AppendFlatStringFromSubtree for container widgets like menulist
|
||||
// Still try the title as as fallback method in that case.
|
||||
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::title, aLabel);
|
||||
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::tooltiptext, label);
|
||||
label.CompressWhitespace();
|
||||
if (!label.IsEmpty()) {
|
||||
aLabel = label;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return AppendFlatStringFromSubtree(content, &aLabel);
|
||||
// Can get text from title of <toolbaritem> if we're a child of a <toolbaritem>
|
||||
nsIContent *bindingParent = content->GetBindingParent();
|
||||
nsIContent *parent = bindingParent? bindingParent->GetParent() :
|
||||
content->GetParent();
|
||||
if (parent && parent->Tag() == nsAccessibilityAtoms::toolbaritem &&
|
||||
NS_CONTENT_ATTR_HAS_VALUE == parent->GetAttr(kNameSpaceID_None,
|
||||
nsAccessibilityAtoms::title,
|
||||
label)) {
|
||||
label.CompressWhitespace();
|
||||
aLabel = label;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Don't use AppendFlatStringFromSubtree for container widgets like menulist
|
||||
return aCanAggregateSubtree? AppendFlatStringFromSubtree(content, &aLabel) : NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::FireToolkitEvent(PRUint32 aEvent, nsIAccessible *aTarget, void * aData)
|
||||
@@ -1346,6 +1355,7 @@ nsRoleMapEntry nsAccessible::gWAIRoleMap[] =
|
||||
{"secret-text", ROLE_PASSWORD_TEXT, eTitleOnly, STATE_PROTECTED, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, // XXX Use ext state STATE_SINGLE_LINE
|
||||
{"select", ROLE_LIST, eTitleOnly, 0, {"readonly", 0, STATE_READONLY}, {"multiselect", 0, STATE_EXTSELECTABLE | STATE_MULTISELECTABLE}, {0, 0, 0}},
|
||||
{"slider", ROLE_SLIDER, eTitleOnly, 0, {"readonly", 0, STATE_READONLY}, {0, 0, 0}, {0, 0, 0}},
|
||||
{"spreadsheet", ROLE_TABLE, eTitleOnly, STATE_MULTISELECTABLE | STATE_EXTSELECTABLE | STATE_FOCUSABLE, {"readonly", 0, STATE_READONLY}, {0, 0, 0}, {0, 0, 0}},
|
||||
{"submit", ROLE_PUSHBUTTON, eAggregateSubtree, STATE_DEFAULT, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
|
||||
{"textarea", ROLE_TEXT, eTitleOnly, 0, {"readonly", 0, STATE_READONLY}, {0, 0, 0}, {0, 0, 0}}, // XXX Use ext state STATE_MULTI_LINE
|
||||
{"textfield", ROLE_TEXT, eTitleOnly, 0, {"readonly", 0, STATE_READONLY}, {0, 0, 0}, {0, 0, 0}}, // XXX Use ext state STATE_SINGLE_LINE
|
||||
|
||||
@@ -84,9 +84,6 @@
|
||||
</field>
|
||||
|
||||
<constructor><![CDATA[
|
||||
// set default property values
|
||||
this.ifSetAttribute("disablehistory", true);
|
||||
|
||||
mController = Components.classes["@mozilla.org/autocomplete/controller;1"].
|
||||
createInstance(Components.interfaces.nsIAutoCompleteController);
|
||||
]]></constructor>
|
||||
@@ -96,9 +93,13 @@
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
// enablehistory="true": dropmarker shows up, so expose as a combobox.
|
||||
// enablehistory="false" (default): no dropmarker, so expose as a textfield.
|
||||
var accService = Components.classes["@mozilla.org/accessibilityService;1"].
|
||||
getService(Components.interfaces.nsIAccessibilityService);
|
||||
return accService.createXULComboboxAccessible(this);
|
||||
return (this.getAttribute("enablehistory") == 'true') ?
|
||||
accService.createXULComboboxAccessible(this) :
|
||||
accService.createXULTextBoxAccessible(this);
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
@@ -219,9 +220,7 @@
|
||||
onset="this.setAttribute('crop',val); return val;"
|
||||
onget="return this.getAttribute('crop');"/>
|
||||
|
||||
<property name="label"
|
||||
onset="this.setAttribute('label',val); return val;"
|
||||
onget="return this.getAttribute('label');"/>
|
||||
<property name="label" readonly="true" onget="return this.mInputElt.value;"/>
|
||||
|
||||
<property name="open"
|
||||
onget="return this.getAttribute('open') == 'true';">
|
||||
|
||||
@@ -177,6 +177,9 @@
|
||||
|
||||
<hbox id="nav-bar-inner" flex="1">
|
||||
<observes element="nav-bar" attribute="buttonstyle"/>
|
||||
<!-- Need hidden label on textbox for accessibility, because what
|
||||
receives focus needs a text name -->
|
||||
<label control="urlbar" hidden="true" value="&locationBar.title;"/>
|
||||
<textbox id="urlbar" class="chromeclass-location uri-element" flex="1"
|
||||
type="autocomplete" searchSessions="history"
|
||||
timeout="50" maxrows="6" alwaysopenpopup="true"
|
||||
|
||||
@@ -180,6 +180,7 @@
|
||||
|
||||
<!ENTITY locationBar.tooltip "Enter search term, keyword, or web address">
|
||||
<!ENTITY locationBar.accesskey "d">
|
||||
<!ENTITY locationBar.title "Location">
|
||||
|
||||
<!ENTITY proxyIcon.tooltip "Drag and drop this icon to create a link to this page">
|
||||
<!ENTITY internetKeyword.tooltip "Return to previously viewed page or choose keyword">
|
||||
|
||||
Reference in New Issue
Block a user