Bug 1121518 - ARIA 1.1: Add support for role 'searchbox', r=surkov

This commit is contained in:
Marco Zehe 2015-02-27 15:41:57 +01:00
parent 237af26045
commit 6052813f7f
11 changed files with 63 additions and 8 deletions

View File

@ -496,6 +496,19 @@ static nsRoleMapEntry sWAIRoleMaps[] =
eARIAOrientation,
eARIAReadonly
},
{ // searchbox
&nsGkAtoms::searchbox,
roles::ENTRY,
kUseMapRole,
eNoValue,
eActivateAction,
eNoLiveAttr,
kGenericAccType,
kNoReqStates,
eARIAAutoComplete,
eARIAMultiline,
eARIAReadonlyOrEditable
},
{ // separator
&nsGkAtoms::separator_,
roles::SEPARATOR,

View File

@ -881,6 +881,11 @@ Accessible::Attributes()
// If there is no aria-live attribute then expose default value of 'live'
// object attribute used for ARIA role of this accessible.
if (mRoleMapEntry) {
if (mRoleMapEntry->Is(nsGkAtoms::searchbox)) {
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::textInputType,
NS_LITERAL_STRING("search"));
}
nsAutoString live;
nsAccUtils::GetAccAttr(attributes, nsGkAtoms::live, live);
if (live.IsEmpty()) {

View File

@ -306,8 +306,13 @@ HTMLTextFieldAccessible::NativeAttributes()
// Expose type for text input elements as it gives some useful context,
// especially for mobile.
nsAutoString type;
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type))
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type)) {
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::textInputType, type);
if (!mRoleMapEntry && type.EqualsLiteral("search")) {
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::xmlroles,
NS_LITERAL_STRING("searchbox"));
}
}
return attributes.forget();
}

View File

@ -460,6 +460,9 @@ GetClosestInterestingAccessible(id anObject)
if (token.EqualsLiteral("search"))
return @"AXLandmarkSearch";
if (token.EqualsLiteral("searchbox"))
return @"AXSearchField";
}
switch (mRole) {
@ -496,6 +499,8 @@ GetClosestInterestingAccessible(id anObject)
return utils::LocalizedString(NS_LITERAL_STRING("term"));
if ((mRole == roles::PARAGRAPH) && [subrole isEqualToString:@"AXDefinition"])
return utils::LocalizedString(NS_LITERAL_STRING("definition"));
if ((mRole == roles::ENTRY) && [subrole isEqualToString:@"AXSearchField"])
return utils::LocalizedString(NS_LITERAL_STRING("searchTextField"));
NSString* role = [self role];

View File

@ -108,6 +108,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
testAttrs("tel", {"text-input-type" : "tel"}, true);
testAttrs("url", {"text-input-type" : "url"}, true);
// ARIA
testAttrs("searchbox", {"text-input-type" : "search"}, true);
// html
testAttrs("radio", {"checkable" : "true"}, true);
testAttrs("checkbox", {"checkable" : "true"}, true);
@ -183,6 +186,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
title="aria-hidden false value shouldn't be exposed via object attributes">
Mozilla Bug 838407
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1121518"
title="ARIA 1.1: Support role 'searchbox'">
Mozilla Bug 1121518
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
@ -242,6 +250,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
<input id="search" type="search"/>
<input id="tel" type="tel"/>
<input id="url" type="url"/>
<div id="searchbox" role="searchbox"></div>
<!-- html -->
<input id="radio" type="radio"/>

View File

@ -34,6 +34,8 @@
testAttrs("article", {"xml-roles" : "article"}, true);
testAttrs("main_element", {"xml-roles" : "main"}, true);
testAttrs("search", {"xml-roles" : "searchbox"}, true);
SimpleTest.finish();
}
@ -78,6 +80,11 @@
title="modify HTML5 header and footer accessibility API mapping">
Bug 849624
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1121518"
title="ARIA 1.1: Support role 'searchbox'">
Bug 1121518
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
@ -101,5 +108,6 @@
<article id="article">article</article>
<main id="main_element">another main area</main>
<input id="search" type="search"/>
</body>
</html>

View File

@ -165,22 +165,22 @@
</a><br>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=648133"
title="fire state change event for aria-busy"
title="fire state change event for aria-busy">
Mozilla Bug 648133
</a><br>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=467143"
title="mixed state change event is fired for focused accessible only"
title="mixed state change event is fired for focused accessible only">
Mozilla Bug 467143
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=989958"
title="Pressed state is not exposed on a button element with aria-pressed attribute"
title="Pressed state is not exposed on a button element with aria-pressed attribute">
Mozilla Bug 989958
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1136563"
title="Support ARIA 1.1 switch role"
title="Support ARIA 1.1 switch role">
Mozilla Bug 1136563
</a>

View File

@ -56,6 +56,7 @@
testRole("aria_row", ROLE_ROW);
testRole("aria_rowheader", ROLE_ROWHEADER);
testRole("aria_scrollbar", ROLE_SCROLLBAR);
testRole("aria_searchbox", ROLE_ENTRY);
testRole("aria_separator", ROLE_SEPARATOR);
testRole("aria_slider", ROLE_SLIDER);
testRole("aria_spinbutton", ROLE_SPINBUTTON);
@ -181,9 +182,14 @@
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1136563"
title="Support ARIA 1.1 switch role"
title="Support ARIA 1.1 switch role">
Bug 1136563
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1121518"
title="Support ARIA 1.1 searchbox role">
Bug 1121518
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
@ -227,6 +233,7 @@
<span id="aria_row" role="row"/>
<span id="aria_rowheader" role="rowheader"/>
<span id="aria_scrollbar" role="scrollbar"/>
<span id="aria_searchbox" role="textbox"/>
<span id="aria_separator" role="separator"/>
<span id="aria_slider" role="slider"/>
<span id="aria_spinbutton" role="spinbutton"/>

View File

@ -349,12 +349,12 @@
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=989958"
title="Pressed state is not exposed on a button element with aria-pressed attribute"
title="Pressed state is not exposed on a button element with aria-pressed attribute">
Mozilla Bug 989958
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1136563"
title="Support ARIA 1.1 switch role"
title="Support ARIA 1.1 switch role">
Mozilla Bug 1136563
</a>

View File

@ -2291,6 +2291,7 @@ GK_ATOM(progressbar, "progressbar")
GK_ATOM(region, "region")
GK_ATOM(rowgroup, "rowgroup")
GK_ATOM(rowheader, "rowheader")
GK_ATOM(searchbox, "searchbox")
GK_ATOM(select1, "select1")
GK_ATOM(setsize, "setsize")
GK_ATOM(spelling, "spelling")

View File

@ -25,6 +25,8 @@ tab = tab
# The Role Description for definition list dl, dt and dd
term = term
definition = definition
# The Role Description for an input type="search" text field
searchTextField = search text field
# The Role Description for WAI-ARIA Landmarks
search = search
banner = banner