Bug 1201146 - Introduce "Section" traversal rule. r=yzen

This commit is contained in:
Eitan Isaacson 2015-09-04 10:04:19 -07:00
parent 4ae6af1589
commit f19304d593
3 changed files with 39 additions and 11 deletions

View File

@ -224,6 +224,28 @@ this.TraversalRules = { // jshint ignore:line
Filters.IGNORE;
}, null, true),
/* A rule for Android's section navigation, lands on landmarks, regions, and
on headings to aid navigation of traditionally structured documents */
Section: new BaseTraversalRule(
[],
function Section_match(aAccessible) {
if (aAccessible.role === Roles.HEADING) {
return Filters.MATCH;
}
let matchedRole = Utils.matchRoles(aAccessible, [
'banner',
'complementary',
'contentinfo',
'main',
'navigation',
'search',
'region'
]);
return matchedRole ? Filters.MATCH : Filters.IGNORE;
}, null, true),
Entry: new BaseTraversalRule(
[Roles.ENTRY,
Roles.PASSWORD_TEXT]),

View File

@ -82,16 +82,20 @@
</li>
<li id="listitem-2-3">JavaScript</li>
</ul>
<h6 id="heading-5">The last (visible) one!</h6>
<img id="image-1" src="http://example.com" alt="">
<img id="image-2" src="../moz.png" alt="stuff">
<div id="image-3" tabindex="0" role="img">Not actually an image</div>
<h4 id="heading-6" aria-hidden="true">Hidden header</h4>
<a id="link-1" href="http://www.mozilla.org">Link</a>
<a id="anchor-1">Words</a>
<a id="link-2" href="http://www.mozilla.org">Link the second</a>
<a id="anchor-2">Sentences</a>
<a id="link-3" href="http://www.example.com">Link the third</a>
<section>
<h6 id="heading-5">The last (visible) one!</h6>
<img id="image-1" src="http://example.com" alt="">
<img id="image-2" src="../moz.png" alt="stuff">
<div id="image-3" tabindex="0" role="img">Not actually an image</div>
</section>
<section>
<h4 id="heading-6" aria-hidden="true">Hidden header</h4>
<a id="link-1" href="http://www.mozilla.org">Link</a>
<a id="anchor-1">Words</a>
<a id="link-2" href="http://www.mozilla.org">Link the second</a>
<a id="anchor-2">Sentences</a>
<a id="link-3" href="http://www.example.com">Link the third</a>
</section>
<hr id="separator-1">
<h6 id="heading-6"></h6>
<table id="table-1">

View File

@ -83,7 +83,9 @@
testTraversalHelper('List',
['Programming Language', 'listitem-2-1', 'listitem-3-1']);
vc.position = null;
testTraversalHelper('Section',
['heading-1', 'heading-2', 'heading-3',
'heading-5', 'link-1', 'statusbar-1']);
SimpleTest.finish();
}