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; Filters.IGNORE;
}, null, true), }, 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( Entry: new BaseTraversalRule(
[Roles.ENTRY, [Roles.ENTRY,
Roles.PASSWORD_TEXT]), Roles.PASSWORD_TEXT]),

View File

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

View File

@ -83,7 +83,9 @@
testTraversalHelper('List', testTraversalHelper('List',
['Programming Language', 'listitem-2-1', 'listitem-3-1']); ['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(); SimpleTest.finish();
} }