OLD | NEW |
1 <!-- | 1 <!-- |
2 @license | 2 @license |
3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
7 Code distributed by Google as part of the polymer project is also | 7 Code distributed by Google as part of the polymer project is also |
8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
9 --> | 9 --> |
10 | 10 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 * Given a KeyboardEvent, this method will focus the appropriate item in the | 121 * Given a KeyboardEvent, this method will focus the appropriate item in the |
122 * menu (if there is a relevant item, and it is possible to focus it). | 122 * menu (if there is a relevant item, and it is possible to focus it). |
123 * | 123 * |
124 * @param {KeyboardEvent} event A KeyboardEvent. | 124 * @param {KeyboardEvent} event A KeyboardEvent. |
125 */ | 125 */ |
126 _focusWithKeyboardEvent: function(event) { | 126 _focusWithKeyboardEvent: function(event) { |
127 for (var i = 0, item; item = this.items[i]; i++) { | 127 for (var i = 0, item; item = this.items[i]; i++) { |
128 var attr = this.attrForItemTitle || 'textContent'; | 128 var attr = this.attrForItemTitle || 'textContent'; |
129 var title = item[attr] || item.getAttribute(attr); | 129 var title = item[attr] || item.getAttribute(attr); |
130 | 130 |
131 if (!item.hasAttribute('disabled') && title && | 131 if (!item.hasAttribute('disabled') && title && |
132 title.trim().charAt(0).toLowerCase() === String.fromCharCode(event.k
eyCode).toLowerCase()) { | 132 title.trim().charAt(0).toLowerCase() === String.fromCharCode(event.k
eyCode).toLowerCase()) { |
133 this._setFocusedItem(item); | 133 this._setFocusedItem(item); |
134 break; | 134 break; |
135 } | 135 } |
136 } | 136 } |
137 }, | 137 }, |
138 | 138 |
139 /** | 139 /** |
140 * Focuses the previous item (relative to the currently focused item) in the | 140 * Focuses the previous item (relative to the currently focused item) in the |
141 * menu, disabled items will be skipped. | 141 * menu, disabled items will be skipped. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 }, | 202 }, |
203 | 203 |
204 /** | 204 /** |
205 * A handler that responds to mutation changes related to the list of items | 205 * A handler that responds to mutation changes related to the list of items |
206 * in the menu. | 206 * in the menu. |
207 * | 207 * |
208 * @param {CustomEvent} event An event containing mutation records as its | 208 * @param {CustomEvent} event An event containing mutation records as its |
209 * detail. | 209 * detail. |
210 */ | 210 */ |
211 _onIronItemsChanged: function(event) { | 211 _onIronItemsChanged: function(event) { |
212 var mutations = event.detail; | 212 if (event.detail.addedNodes.length) { |
213 var mutation; | 213 this._resetTabindices(); |
214 var index; | |
215 | |
216 for (index = 0; index < mutations.length; ++index) { | |
217 mutation = mutations[index]; | |
218 | |
219 if (mutation.addedNodes.length) { | |
220 this._resetTabindices(); | |
221 break; | |
222 } | |
223 } | 214 } |
224 }, | 215 }, |
225 | 216 |
226 /** | 217 /** |
227 * Handler that is called when a shift+tab keypress is detected by the menu. | 218 * Handler that is called when a shift+tab keypress is detected by the menu. |
228 * | 219 * |
229 * @param {CustomEvent} event A key combination event. | 220 * @param {CustomEvent} event A key combination event. |
230 */ | 221 */ |
231 _onShiftTabDown: function(event) { | 222 _onShiftTabDown: function(event) { |
232 var oldTabIndex = this.getAttribute('tabindex'); | 223 var oldTabIndex = this.getAttribute('tabindex'); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 Polymer.IronMenuBehaviorImpl._shiftTabPressed = false; | 325 Polymer.IronMenuBehaviorImpl._shiftTabPressed = false; |
335 | 326 |
336 /** @polymerBehavior Polymer.IronMenuBehavior */ | 327 /** @polymerBehavior Polymer.IronMenuBehavior */ |
337 Polymer.IronMenuBehavior = [ | 328 Polymer.IronMenuBehavior = [ |
338 Polymer.IronMultiSelectableBehavior, | 329 Polymer.IronMultiSelectableBehavior, |
339 Polymer.IronA11yKeysBehavior, | 330 Polymer.IronA11yKeysBehavior, |
340 Polymer.IronMenuBehaviorImpl | 331 Polymer.IronMenuBehaviorImpl |
341 ]; | 332 ]; |
342 | 333 |
343 </script> | 334 </script> |
OLD | NEW |