4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-menu-KeyNav'>/**
19 </span> * @class Ext.menu.KeyNav
22 Ext.define('Ext.menu.KeyNav', {
23 extend: 'Ext.util.KeyNav',
25 requires: ['Ext.FocusManager'],
27 constructor: function(menu) {
31 me.callParent([menu.el, {
45 fi = me.menu.focusedItem;
47 if (fi && e.getKey() == Ext.EventObject.DOWN && me.isWhitelisted(fi)) {
56 if (menu.activeItem) {
62 Ext.menu.Manager.hideAll();
65 focusNextItem: function(step) {
68 focusedItem = menu.focusedItem,
69 startIdx = focusedItem ? items.indexOf(focusedItem) : -1,
70 idx = startIdx + step;
72 while (idx != startIdx) {
74 idx = items.length - 1;
75 } else if (idx >= items.length) {
79 var item = items.getAt(idx);
80 if (menu.canActivateItem(item)) {
81 menu.setActiveItem(item);
88 isWhitelisted: function(item) {
89 return Ext.FocusManager.isWhitelisted(item);
94 fi = menu.focusedItem,
97 if (fi && this.isWhitelisted(fi)) {
102 if (menu.parentMenu) {
103 menu.parentMenu.focus();
108 var menu = this.menu,
109 fi = menu.focusedItem,
110 ai = menu.activeItem,
113 if (fi && this.isWhitelisted(fi)) {
118 am = menu.activeItem.menu;
121 Ext.defer(function() {
122 am.setActiveItem(am.items.getAt(0));
140 fi = me.menu.focusedItem;
142 if (fi && e.getKey() == Ext.EventObject.UP && me.isWhitelisted(fi)) {
145 me.focusNextItem(-1);