Skip to content
Permalink
Browse files

Menu: Added Home moves to first item and End moves to last item in cu…

…rrently active menu or submenu. Also fixed PageUp and PageDown so that they don't wrap back around to other end of menu. Also fixed scrolling to use activeMenu rather than element to all. Also added unit tests for keyboard nav
  • Loading branch information
kborchers committed Jul 25, 2011
1 parent 51ee3be commit 23340f1162cbe64c2dc58e97130b20c3f3562192
Showing with 504 additions and 21 deletions.
  1. +157 −2 tests/unit/menu/menu.html
  2. +305 −0 tests/unit/menu/menu_events.js
  3. +42 −19 ui/jquery.ui.menu.js
@@ -31,7 +31,7 @@
$("#log").data("lastItem",item);
$('li:eq(' + item + ') a',menu).trigger("click");
}


</script>
<script type="text/javascript" src="menu_core.js"></script>
@@ -41,10 +41,12 @@
<script type="text/javascript" src="menu_options.js"></script>

<script type="text/javascript" src="../swarminject.js"></script>

<style>
#qunit-fixture { font-size: 10pt; font-family: 'trebuchet ms', verdana, arial; }
#list, #list1 *, #navigation, #navigation * { margin: 0; padding: 0; font-size: 12px; }
#menu3 { height: 250px; overflow: auto; }
#menu4, #menu4 ul { height: 250px; overflow: auto; }
</style>
</head>
<body>
@@ -66,6 +68,159 @@ <h2 id="qunit-userAgent"></h2>
<li class="foo"><a class="foo" href="#">Addyston</a></li>
<li class="foo"><a class="foo" href="#">Adelphi</a></li>
</ul>

<ul id="menu2">
<li class="foo"><a class="foo" href="#">Aberdeen</a></li>
<li class="foo"><a class="foo" href="#">Ada</a></li>
<li class="foo"><a class="foo" href="#">Adamsville</a></li>
<li class="foo"><a class="foo" href="#">Addyston</a></li>
<li>
<a href="#">Delphi</a>
<ul>
<li class="foo"><a class="foo" href="#">Ada</a></li>
<li class="foo"><a class="foo" href="#">Saarland</a></li>
<li class="foo"><a class="foo" href="#">Salzburg</a></li>
</ul>
</li>
<li class="foo"><a class="foo" href="#">Saarland</a></li>
<li>
<a href="#">Salzburg</a>
<ul>
<li>
<a href="#">Delphi</a>
<ul>
<li class="foo"><a class="foo" href="#">Ada</a></li>
<li class="foo"><a class="foo" href="#">Saarland</a></li>
<li class="foo"><a class="foo" href="#">Salzburg</a></li>
</ul>
</li>
<li>
<a href="#">Delphi</a>
<ul>
<li class="foo"><a class="foo" href="#">Ada</a></li>
<li class="foo"><a class="foo" href="#">Saarland</a></li>
<li class="foo"><a class="foo" href="#">Salzburg</a></li>
</ul>
</li>
<li class="foo"><a class="foo" href="#">Perch</a></li>
</ul>
</li>
</ul>

<ul class="foo" id="menu3">
<li class="foo"><a class="foo" href="#">Aberdeen</a></li>
<li class="foo"><a class="foo" href="#">Ada</a></li>
<li class="foo"><a class="foo" href="#">Adamsville</a></li>
<li class="foo"><a class="foo" href="#">Addyston</a></li>
<li class="foo"><a class="foo" href="#">Adelphi</a></li>
<li class="foo"><a class="foo" href="#">Adena</a></li>
<li class="foo"><a class="foo" href="#">Adrian</a></li>
<li class="foo"><a class="foo" href="#">Akron</a></li>
<li class="foo"><a class="foo" href="#">Albany</a></li>
<li class="foo"><a class="foo" href="#">Alexandria</a></li>
<li class="foo"><a class="foo" href="#">Alger</a></li>
<li class="foo"><a class="foo" href="#">Alledonia</a></li>
<li class="foo"><a class="foo" href="#">Alliance</a></li>
<li class="foo"><a class="foo" href="#">Alpha</a></li>
<li class="foo"><a class="foo" href="#">Alvada</a></li>
<li class="foo"><a class="foo" href="#">Alvordton</a></li>
<li class="foo"><a class="foo" href="#">Amanda</a></li>
<li class="foo"><a class="foo" href="#">Amelia</a></li>
<li class="foo"><a class="foo" href="#">Amesville</a></li>
<li class="foo"><a class="foo" href="#">Aberdeen</a></li>
<li class="foo"><a class="foo" href="#">Ada</a></li>
<li class="foo"><a class="foo" href="#">Adamsville</a></li>
<li class="foo"><a class="foo" href="#">Addyston</a></li>
<li class="foo"><a class="foo" href="#">Adelphi</a></li>
<li class="foo"><a class="foo" href="#">Adena</a></li>
<li class="foo"><a class="foo" href="#">Adrian</a></li>
<li class="foo"><a class="foo" href="#">Akron</a></li>
<li class="foo"><a class="foo" href="#">Albany</a></li>
<li class="foo"><a class="foo" href="#">Alexandria</a></li>
<li class="foo"><a class="foo" href="#">Alger</a></li>
<li class="foo"><a class="foo" href="#">Alledonia</a></li>
<li class="foo"><a class="foo" href="#">Alliance</a></li>
<li class="foo"><a class="foo" href="#">Alpha</a></li>
<li class="foo"><a class="foo" href="#">Alvada</a></li>
<li class="foo"><a class="foo" href="#">Alvordton</a></li>
<li class="foo"><a class="foo" href="#">Amanda</a></li>
<li class="foo"><a class="foo" href="#">Amelia</a></li>
<li class="foo"><a class="foo" href="#">Amesville</a></li>
</ul>

<ul class="foo" id="menu4">
<li class="foo"><a class="foo" href="#">Aberdeen</a></li>
<li class="foo">
<a class="foo" href="#">Ada</a>
<ul class="foo">
<li class="foo"><a class="foo" href="#">Aberdeen</a></li>
<li class="foo"><a class="foo" href="#">Ada</a></li>
<li class="foo"><a class="foo" href="#">Adamsville</a></li>
<li class="foo"><a class="foo" href="#">Addyston</a></li>
<li class="foo"><a class="foo" href="#">Adelphi</a></li>
<li class="foo"><a class="foo" href="#">Adena</a></li>
<li class="foo"><a class="foo" href="#">Adrian</a></li>
<li class="foo"><a class="foo" href="#">Akron</a></li>
<li class="foo"><a class="foo" href="#">Albany</a></li>
<li class="foo"><a class="foo" href="#">Alexandria</a></li>
<li class="foo"><a class="foo" href="#">Alger</a></li>
<li class="foo"><a class="foo" href="#">Alledonia</a></li>
<li class="foo"><a class="foo" href="#">Alliance</a></li>
<li class="foo"><a class="foo" href="#">Alpha</a></li>
<li class="foo"><a class="foo" href="#">Alvada</a></li>
<li class="foo"><a class="foo" href="#">Alvordton</a></li>
<li class="foo"><a class="foo" href="#">Amanda</a></li>
<li class="foo"><a class="foo" href="#">Amelia</a></li>
<li class="foo"><a class="foo" href="#">Amesville</a></li>
<li class="foo"><a class="foo" href="#">Aberdeen</a></li>
<li class="foo"><a class="foo" href="#">Ada</a></li>
<li class="foo"><a class="foo" href="#">Adamsville</a></li>
<li class="foo"><a class="foo" href="#">Addyston</a></li>
<li class="foo"><a class="foo" href="#">Adelphi</a></li>
<li class="foo"><a class="foo" href="#">Adena</a></li>
<li class="foo"><a class="foo" href="#">Adrian</a></li>
<li class="foo"><a class="foo" href="#">Akron</a></li>
<li class="foo"><a class="foo" href="#">Albany</a></li>
</ul>
</li>
<li class="foo"><a class="foo" href="#">Adamsville</a></li>
<li class="foo"><a class="foo" href="#">Addyston</a></li>
<li class="foo"><a class="foo" href="#">Adelphi</a></li>
<li class="foo"><a class="foo" href="#">Adena</a></li>
<li class="foo"><a class="foo" href="#">Adrian</a></li>
<li class="foo"><a class="foo" href="#">Akron</a></li>
<li class="foo"><a class="foo" href="#">Albany</a></li>
<li class="foo"><a class="foo" href="#">Alexandria</a></li>
<li class="foo"><a class="foo" href="#">Alger</a></li>
<li class="foo"><a class="foo" href="#">Alledonia</a></li>
<li class="foo"><a class="foo" href="#">Alliance</a></li>
<li class="foo"><a class="foo" href="#">Alpha</a></li>
<li class="foo"><a class="foo" href="#">Alvada</a></li>
<li class="foo"><a class="foo" href="#">Alvordton</a></li>
<li class="foo"><a class="foo" href="#">Amanda</a></li>
<li class="foo"><a class="foo" href="#">Amelia</a></li>
<li class="foo"><a class="foo" href="#">Amesville</a></li>
<li class="foo"><a class="foo" href="#">Aberdeen</a></li>
<li class="foo"><a class="foo" href="#">Ada</a></li>
<li class="foo"><a class="foo" href="#">Adamsville</a></li>
<li class="foo"><a class="foo" href="#">Addyston</a></li>
<li class="foo"><a class="foo" href="#">Adelphi</a></li>
<li class="foo"><a class="foo" href="#">Adena</a></li>
<li class="foo"><a class="foo" href="#">Adrian</a></li>
<li class="foo"><a class="foo" href="#">Akron</a></li>
<li class="foo"><a class="foo" href="#">Albany</a></li>
<li class="foo"><a class="foo" href="#">Alexandria</a></li>
<li class="foo"><a class="foo" href="#">Alger</a></li>
<li class="foo"><a class="foo" href="#">Alledonia</a></li>
<li class="foo"><a class="foo" href="#">Alliance</a></li>
<li class="foo"><a class="foo" href="#">Alpha</a></li>
<li class="foo"><a class="foo" href="#">Alvada</a></li>
<li class="foo"><a class="foo" href="#">Alvordton</a></li>
<li class="foo"><a class="foo" href="#">Amanda</a></li>
<li class="foo"><a class="foo" href="#">Amelia</a></li>
<li class="foo"><a class="foo" href="#">Amesville</a></li>
</ul>

<div id="log"></div>

</div>

0 comments on commit 23340f1

Please sign in to comment.
You can’t perform that action at this time.