Bug 971212 - Implement ARIA role=none, r=davidb

This commit is contained in:
Alexander Surkov 2015-02-19 12:50:34 -05:00
parent 6996bd8f54
commit a3e4eb6dcc
3 changed files with 72 additions and 14 deletions

View file

@ -366,6 +366,16 @@ static nsRoleMapEntry sWAIRoleMaps[] =
kNoReqStates, kNoReqStates,
eARIACheckableBool eARIACheckableBool
}, },
{ // none
&nsGkAtoms::none,
roles::NOTHING,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kGenericAccType,
kNoReqStates
},
{ // note { // note
&nsGkAtoms::note_, &nsGkAtoms::note_,
roles::NOTE, roles::NOTE,

View file

@ -962,7 +962,9 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
// If the element is focusable or global ARIA attribute is applied to it or // If the element is focusable or global ARIA attribute is applied to it or
// it is referenced by ARIA relationship then treat role="presentation" on // it is referenced by ARIA relationship then treat role="presentation" on
// the element as the role is not there. // the element as the role is not there.
if (roleMapEntry && roleMapEntry->Is(nsGkAtoms::presentation)) { if (roleMapEntry &&
(roleMapEntry->Is(nsGkAtoms::presentation) ||
roleMapEntry->Is(nsGkAtoms::none))) {
if (!MustBeAccessible(content, document)) if (!MustBeAccessible(content, document))
return nullptr; return nullptr;

View file

@ -21,14 +21,18 @@
// Presentation role don't allow accessible. // Presentation role don't allow accessible.
var tree = var tree =
{ SECTION: [ // container { SECTION: [ // container
{ TEXT_LEAF: [ ] } // child text of presentation node { TEXT_LEAF: [ ] }, // child text of 'presentation' node
{ TEXT_LEAF: [ ] } // child text of 'none' node
] }; ] };
testAccessibleTree("div_cnt", tree); testAccessibleTree("div_cnt", tree);
// Focusable element, presentation role is ignored. // Focusable element, 'presentation' and 'none' roles are ignored.
tree = tree =
{ SECTION: [ // container { SECTION: [ // container
{ PUSHBUTTON: [ // button { PUSHBUTTON: [ // button having 'presentation' role
{ TEXT_LEAF: [ ] }
] },
{ PUSHBUTTON: [ // button having 'none' role
{ TEXT_LEAF: [ ] } { TEXT_LEAF: [ ] }
] } ] }
] }; ] };
@ -37,18 +41,28 @@
// Presentation table, no table structure is exposed. // Presentation table, no table structure is exposed.
tree = tree =
{ SECTION: [ // container { SECTION: [ // container
{ TEXT_CONTAINER: [ // td generic accessible { TEXT_CONTAINER: [ // td generic accessible inside 'presentation' table
{ TEXT_LEAF: [ ] } // cell text
] },
{ TEXT_CONTAINER: [ // td generic accessible inside 'none' table
{ TEXT_LEAF: [ ] } // cell text { TEXT_LEAF: [ ] } // cell text
] } ] }
] }; ] };
testAccessibleTree("tbl_cnt", tree); testAccessibleTree("tbl_cnt", tree);
// Focusable table, presentation role is ignored. // Focusable table, 'presentation' and 'none' roles are ignored.
tree = tree =
{ SECTION: [ // container { SECTION: [ // container
{ TABLE: [ // table { TABLE: [ // table having 'presentation' role
{ ROW: [ // tr { ROW: [ // tr
{ CELL: [ //td { CELL: [ // td
{ TEXT_LEAF: [ ] }
] }
] }
] },
{ TABLE: [ // table having 'none' role
{ ROW: [ // tr
{ CELL: [ // td
{ TEXT_LEAF: [ ] } { TEXT_LEAF: [ ] }
] } ] }
] } ] }
@ -59,15 +73,27 @@
// Presentation list, expose generic accesisble for list items. // Presentation list, expose generic accesisble for list items.
tree = tree =
{ SECTION: [ // container { SECTION: [ // container
{ PARAGRAPH: [ // li generic accessible { PARAGRAPH: [ // li generic accessible inside 'presentation' role
{ TEXT_LEAF: [ ] } // li text
] },
{ PARAGRAPH: [ // li generic accessible inside 'none' role
{ TEXT_LEAF: [ ] } // li text { TEXT_LEAF: [ ] } // li text
] } ] }
] }; ] };
testAccessibleTree("list_cnt", tree); testAccessibleTree("list_cnt", tree);
// Has ARIA globals or referred by ARIA relationship. // Has ARIA globals or referred by ARIA relationship, role='presentation'
// and role='none' are ignored.
tree = tree =
{ SECTION: [ // container { SECTION: [ // container
{ LABEL: [ // label, has aria-owns
{ TEXT_LEAF: [ ] }
] },
{ TEXT_LEAF: [ ] },
{ LABEL: [ // label, referenced by aria-owns
{ TEXT_LEAF: [ ] }
] },
{ TEXT_LEAF: [ ] },
{ LABEL: [ // label, has aria-owns { LABEL: [ // label, has aria-owns
{ TEXT_LEAF: [ ] } { TEXT_LEAF: [ ] }
] }, ] },
@ -90,21 +116,26 @@
<a target="_blank" <a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=548291" href="https://bugzilla.mozilla.org/show_bug.cgi?id=548291"
title="Accessible tree of ARIA image maps"> title="Accessible tree of ARIA image maps">
Mozilla Bug 548291 Bug 548291
</a> </a>
<a target="_blank" <a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=666504" href="https://bugzilla.mozilla.org/show_bug.cgi?id=666504"
title="Ignore role presentation on focusable elements"> title="Ignore role presentation on focusable elements">
Mozilla Bug 666504 Bug 666504
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=971212"
title="Implement ARIA role=none">
Bug 971212
</a> </a>
<p id="display"></p> <p id="display"></p>
<div id="content" style="display: none"></div> <div id="content" style="display: none"></div>
<pre id="test"> <pre id="test">
</pre> </pre>
<div id="div_cnt"><div role="presentation">text</div></div> <div id="div_cnt"><div role="presentation">t</div><div role="none">t</div></div>
<div id="btn_cnt"><button role="presentation">btn</button></div> <div id="btn_cnt"><button role="presentation">btn</button><button role="none">btn</button></div>
<div id="tbl_cnt"> <div id="tbl_cnt">
<table role="presentation"> <table role="presentation">
@ -112,6 +143,11 @@
<td>cell</td> <td>cell</td>
</tr> </tr>
</table> </table>
<table role="none">
<tr>
<td>cell</td>
</tr>
</table>
</div> </div>
<div id="tblfocusable_cnt"> <div id="tblfocusable_cnt">
@ -120,17 +156,27 @@
<td>cell</td> <td>cell</td>
</tr> </tr>
</table> </table>
<table role="none" tabindex="0">
<tr>
<td>cell</td>
</tr>
</table>
</div> </div>
<div id="list_cnt"> <div id="list_cnt">
<ul role="presentation"> <ul role="presentation">
<li>item</li> <li>item</li>
</ul> </ul>
<ul role="none">
<li>item</li>
</ul>
</div> </div>
<div id="airaglobalprop_cnt"> <div id="airaglobalprop_cnt">
<label role="presentation" aria-owns="ariaowned">has aria-owns</label> <label role="presentation" aria-owns="ariaowned">has aria-owns</label>
<label role="presentation" id="ariaowned">referred by aria-owns</label> <label role="presentation" id="ariaowned">referred by aria-owns</label>
<label role="none" aria-owns="ariaowned2">has aria-owns</label>
<label role="none" id="ariaowned2">referred by aria-owns</label>
</div> </div>
</body> </body>