Closed Bug 1121518 Opened 5 years ago Closed 5 years ago

[ARIA 1.1] Provide mapping for new "searchbox" role

Categories

(Core :: Disability Access APIs, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla39
Tracking Status
firefox39 --- fixed

People

(Reporter: MarcoZ, Assigned: MarcoZ)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

We already map the HTML5 input @type="search" to a textbox with an additional AccessibleAttribute "text-input-type": http://mxr.mozilla.org/mozilla-central/source/accessible/html/HTMLFormControlAccessible.cpp#310

We can simply adjust the new role exposure to match that, and everyone who picks up on this will automatically pick up the new role. This may also be feasible for Orca.
(In reply to Marco Zehe (:MarcoZ) from comment #0)
> We already map the HTML5 input @type="search" to a textbox with an
> additional AccessibleAttribute "text-input-type":
> http://mxr.mozilla.org/mozilla-central/source/accessible/html/
> HTMLFormControlAccessible.cpp#310

agree, makes sense to "searchbox" role too

> We can simply adjust the new role exposure to match that, and everyone who
> picks up on this will automatically pick up the new role. This may also be
> feasible for Orca.

what do you mean by new role?
(In reply to alexander :surkov from comment #1)
> (In reply to Marco Zehe (:MarcoZ) from comment #0)
> > We can simply adjust the new role exposure to match that, and everyone who
> > picks up on this will automatically pick up the new role. This may also be
> > feasible for Orca.
> 
> what do you mean by new role?

Sorry, the new ARIA role. It'll just start working for screen readers.
Attached patch PatchSplinter Review
Added role support for searchbox, made it also expose the text-input-type, and in reverse, made input type="search" expose the xml-role of "searchbox". Also added the subrole and role description for Mac. Added tests, and found a few missing closing > in some of the links in files I touched in bug 1136563. Decided to just fix them here.
Assignee: nobody → mzehe
Status: NEW → ASSIGNED
Attachment #8569935 - Flags: review?(surkov.alexander)
Comment on attachment 8569935 [details] [diff] [review]
Patch

Review of attachment 8569935 [details] [diff] [review]:
-----------------------------------------------------------------

::: accessible/generic/Accessible.cpp
@@ +865,5 @@
>    if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::role, xmlRoles)) {
>      attributes->SetStringProperty(NS_LITERAL_CSTRING("xml-roles"),
>                                    xmlRoles, unused);
> +    if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::role,
> +                              nsGkAtoms::searchbox, eCaseMatters)) {

it'd be good to move into if (mRoleMapEntry) block below (where live attrs are hosted) and change it to

if (mRoleMapEntry->Is(nsGkAtoms::searchbox)) {
}

@@ +868,5 @@
> +    if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::role,
> +                              nsGkAtoms::searchbox, eCaseMatters)) {
> +      nsAccUtils::SetAccAttr(attributes, nsGkAtoms::textInputType,
> +                             NS_LITERAL_STRING("search"));
> +    }    

nit: whitespaces

::: accessible/html/HTMLFormControlAccessible.cpp
@@ +310,2 @@
>      nsAccUtils::SetAccAttr(attributes, nsGkAtoms::textInputType, type);
> +    if (type.Equals(NS_LITERAL_STRING("search"))) {

EqualsLiteral

@@ +310,4 @@
>      nsAccUtils::SetAccAttr(attributes, nsGkAtoms::textInputType, type);
> +    if (type.Equals(NS_LITERAL_STRING("search"))) {
> +      nsAccUtils::SetAccAttr(attributes, nsGkAtoms::xmlroles,
> +                             NS_LITERAL_STRING("searchbox"));

this overrides ARIA role on the element which is probably unwanted

::: accessible/mac/mozAccessible.mm
@@ +499,5 @@
>      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"));

one day Accessible should provide methods for these
Attachment #8569935 - Flags: review?(surkov.alexander) → review+
Flags: in-testsuite+
https://hg.mozilla.org/mozilla-central/rev/3a1add0cbe84
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
You need to log in before you can comment on or make changes to this bug.