Bug 1013584 - presentation list items should expose generic accessibles, r=davidb

This commit is contained in:
Alexander Surkov 2014-11-21 09:13:32 -05:00
parent 03b91def37
commit 91d762ecff
4 changed files with 33 additions and 10 deletions

View File

@ -1555,6 +1555,9 @@ nsAccessibilityService::CreateAccessibleByFrameType(nsIFrame* aFrame,
if (aContext->IsList() &&
aContext->GetContent() == aContent->GetParent()) {
newAcc = new HTMLLIAccessible(aContent, document);
} else {
// Otherwise create a generic text accessible to avoid text jamming.
newAcc = new HyperTextAccessibleWrap(aContent, document);
}
break;
case eHTMLSelectListType:

View File

@ -34,10 +34,15 @@
accTree = { // div@role="list"
role: ROLE_LIST,
children: [
{ // li text leaf
role: ROLE_TEXT_LEAF,
name: "item1",
children: [ ]
{ // li
role: ROLE_PARAGRAPH,
children: [
{ // li text leaf
role: ROLE_TEXT_LEAF,
name: "item1",
children: [ ]
}
]
},
{ // li@role="listitem"
role: ROLE_LISTITEM,

View File

@ -56,6 +56,15 @@
] };
testAccessibleTree("tblfocusable_cnt", tree);
// Presentation list, expose generic accesisble for list items.
tree =
{ SECTION: [ // container
{ PARAGRAPH: [ // li generic accessible
{ TEXT_LEAF: [ ] } // li text
] }
] };
testAccessibleTree("list_cnt", tree);
// Has ARIA globals or referred by ARIA relationship.
tree =
{ SECTION: [ // container
@ -113,6 +122,12 @@
</table>
</div>
<div id="list_cnt">
<ul role="presentation">
<li>item</li>
</ul>
</div>
<div id="airaglobalprop_cnt">
<label role="presentation" aria-owns="ariaowned">has aria-owns</label>
<label role="presentation" id="ariaowned">referred by aria-owns</label>

View File

@ -80,15 +80,15 @@
ok(!isAccessible("presentation_ul"),
"presentational ul shouldn't be accessible");
ok(!isAccessible("item_in_presentation_ul"),
"li in presentational ul shouldn't be accessible");
ok(!isAccessible("styleditem_in_presentation_ul"),
"list styled span in presentational ul shouldn't be accessible");
ok(isAccessible("item_in_presentation_ul"),
"li in presentational ul should have generic accessible");
ok(isAccessible("styleditem_in_presentation_ul"),
"list styled span in presentational ul should have generic accessible");
ok(!isAccessible("presentation_ol"),
"presentational ol shouldn't be accessible");
ok(!isAccessible("item_in_presentation_ol"),
"li in presentational ol shouldn't be accessible");
ok(isAccessible("item_in_presentation_ol"),
"li in presentational ol should have generic accessible");
ok(!isAccessible("presentation_dl"),
"presentational dl shouldn't be accessible");