4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../resources/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)) {
55 focused = menu.focusedItem;
57 if (menu.activeItem) {
59 } else if (focused && focused.isFormField) {
60 // prevent stopEvent being called
66 Ext.menu.Manager.hideAll();
69 focusNextItem: function(step) {
72 focusedItem = menu.focusedItem,
73 startIdx = focusedItem ? items.indexOf(focusedItem) : -1,
74 idx = startIdx + step;
76 while (idx != startIdx) {
78 idx = items.length - 1;
79 } else if (idx >= items.length) {
83 var item = items.getAt(idx);
84 if (menu.canActivateItem(item)) {
85 menu.setActiveItem(item);
92 isWhitelisted: function(item) {
93 return Ext.FocusManager.isWhitelisted(item);
98 fi = menu.focusedItem,
101 if (fi && this.isWhitelisted(fi)) {
106 if (menu.parentMenu) {
107 menu.parentMenu.focus();
112 var menu = this.menu,
113 fi = menu.focusedItem,
114 ai = menu.activeItem,
117 if (fi && this.isWhitelisted(fi)) {
122 am = menu.activeItem.menu;
125 Ext.defer(function() {
126 am.setActiveItem(am.items.getAt(0));
144 fi = me.menu.focusedItem;
146 if (fi && e.getKey() == Ext.EventObject.UP && me.isWhitelisted(fi)) {
149 me.focusNextItem(-1);