Bug 1071858 - aria-hidden elements will not be part of childCount when traversing. r=eeejay

---
 accessible/jsat/TraversalRules.jsm                 |  4 ++--
 accessible/jsat/Utils.jsm                          | 10 +++++++++
 accessible/tests/mochitest/jsat/doc_traversal.html | 24 ++++++++++++++++++++++
 .../tests/mochitest/jsat/test_traversal.html       | 18 ++++++++--------
 4 files changed, 46 insertions(+), 10 deletions(-)
This commit is contained in:
Yura Zenevich 2014-09-25 09:57:22 -04:00
parent cff1769d37
commit e49cb25080
4 changed files with 46 additions and 10 deletions

View File

@ -104,7 +104,7 @@ var gSimpleMatchFunc = function gSimpleMatchFunc(aAccessible) {
// or has a flat subtree.
function isSingleLineage(acc) {
for (let child = acc; child; child = child.firstChild) {
if (child.childCount > 1) {
if (Utils.visibleChildCount(child) > 1) {
return false;
}
}
@ -118,7 +118,7 @@ var gSimpleMatchFunc = function gSimpleMatchFunc(aAccessible) {
if ([Roles.TEXT_LEAF, Roles.STATICTEXT].indexOf(child.role) >= 0) {
continue;
}
if (child.childCount > 0 || child.actionCount > 0) {
if (Utils.visibleChildCount(child) > 0 || child.actionCount > 0) {
return false;
}
}

View File

@ -360,6 +360,16 @@ this.Utils = { // jshint ignore:line
return hidden && hidden === 'true';
},
visibleChildCount: function visibleChildCount(aAccessible) {
let count = 0;
for (let child = aAccessible.firstChild; child; child = child.nextSibling) {
if (!this.isHidden(child)) {
++count;
}
}
return count;
},
inHiddenSubtree: function inHiddenSubtree(aAccessible) {
for (let acc=aAccessible; acc; acc=acc.parent) {
if (this.isHidden(acc)) {

View File

@ -3,6 +3,11 @@
<head>
<title>Traversal Rule test document</title>
<meta charset="utf-8" />
<style>
.content:before {
content: "Content";
}
</style>
</head>
<body>
<h3 id="heading-1">A small first heading</h3>
@ -96,6 +101,25 @@
<td>1</td>
</tr>
</table>
<section id="grid" role="grid">
<ol role="row">
<li role="presentation"></li>
<li role="columnheader" aria-label="Sunday">S</li>
<li role="columnheader">M</li>
</ol>
<ol role="row">
<li role="rowheader" aria-label="Week 1">1</li>
<li role="gridcell"><span>3</span><div></div></li>
<li role="gridcell"><span>4</span><div>7</div></li>
</ol>
<ol role="row">
<li role="rowheader">2</li>
<li role="gridcell"><span>5</span><div role="presentation">8</div></li>
<li id="gridcell4" role="gridcell">
<span>6</span><div aria-hidden="true"><div class="content"></div></div>
</li>
</ol>
</section>
<div id="separator-2" role="separator">Just an innocuous separator</div>
<table id="table-2">
<thead>

View File

@ -94,7 +94,7 @@
['separator-1', 'separator-2']);
queueTraversalSequence(gQueue, docAcc, TraversalRules.Table, null,
['table-1', 'table-2']);
['table-1', 'grid', 'table-2']);
queueTraversalSequence(gQueue, docAcc, TraversalRules.Simple, null,
['heading-1', 'Name:', 'input-1-1', 'label-1-2',
@ -114,13 +114,15 @@
' power is unfathomable.',
'• Lists of Programming Languages', 'Lisp ',
'1. Scheme', '2. Racket', '3. Clojure',
'4. Standard Lisp', 'link-0', ' Lisp', 'checkbox-1-5',
' LeLisp', '• JavaScript', 'heading-5',
'image-2', 'image-3', 'Not actually an image',
'link-1', 'anchor-1', 'link-2', 'anchor-2', 'link-3',
'3', '1', '4', '1', 'Just an innocuous separator',
'Dirty Words', 'Meaning', 'Mud', 'Wet Dirt',
'Dirt', 'Messy Stuff']);
'4. Standard Lisp', 'link-0', ' Lisp',
'checkbox-1-5', ' LeLisp', '• JavaScript',
'heading-5', 'image-2', 'image-3',
'Not actually an image', 'link-1', 'anchor-1',
'link-2', 'anchor-2', 'link-3', '3', '1', '4',
'1', 'S', 'M', '1', '3', '4', '7', '2', '5', '8',
'6', 'Just an innocuous separator', 'Dirty Words',
'Meaning', 'Mud', 'Wet Dirt', 'Dirt',
'Messy Stuff']);
gQueue.invoke();
}