| OLD | NEW |
| 1 /** | 1 /** |
| 2 * `Polymer.IronMenuBehavior` implements accessible menu behavior. | 2 * `Polymer.IronMenuBehavior` implements accessible menu behavior. |
| 3 * | 3 * |
| 4 * @demo demo/index.html | 4 * @demo demo/index.html |
| 5 * @polymerBehavior Polymer.IronMenuBehavior | 5 * @polymerBehavior Polymer.IronMenuBehavior |
| 6 */ | 6 */ |
| 7 Polymer.IronMenuBehaviorImpl = { | 7 Polymer.IronMenuBehaviorImpl = { |
| 8 | 8 |
| 9 properties: { | 9 properties: { |
| 10 | 10 |
| 11 /** | 11 /** |
| 12 * Returns the currently focused item. | 12 * Returns the currently focused item. |
| 13 * | 13 * @type {?Object} |
| 14 * @attribute focusedItem | |
| 15 * @type Object | |
| 16 */ | 14 */ |
| 17 focusedItem: { | 15 focusedItem: { |
| 18 observer: '_focusedItemChanged', | 16 observer: '_focusedItemChanged', |
| 19 readOnly: true, | 17 readOnly: true, |
| 20 type: Object | 18 type: Object |
| 21 }, | 19 }, |
| 22 | 20 |
| 23 /** | 21 /** |
| 24 * The attribute to use on menu items to look up the item title. Typing th
e first | 22 * The attribute to use on menu items to look up the item title. Typing th
e first |
| 25 * letter of an item when the menu is open focuses that item. If unset, `t
extContent` | 23 * letter of an item when the menu is open focuses that item. If unset, `t
extContent` |
| 26 * will be used. | 24 * will be used. |
| 27 * | |
| 28 * @attribute attrForItemTitle | |
| 29 * @type String | |
| 30 */ | 25 */ |
| 31 attrForItemTitle: { | 26 attrForItemTitle: { |
| 32 type: String | 27 type: String |
| 33 } | 28 } |
| 34 }, | 29 }, |
| 35 | 30 |
| 36 hostAttributes: { | 31 hostAttributes: { |
| 37 'role': 'menu', | 32 'role': 'menu', |
| 38 'tabindex': '0' | 33 'tabindex': '0' |
| 39 }, | 34 }, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 focusedItem.focus(); | 91 focusedItem.focus(); |
| 97 } | 92 } |
| 98 }, | 93 }, |
| 99 | 94 |
| 100 select: function(value) { | 95 select: function(value) { |
| 101 if (this._defaultFocusAsync) { | 96 if (this._defaultFocusAsync) { |
| 102 this.cancelAsync(this._defaultFocusAsync); | 97 this.cancelAsync(this._defaultFocusAsync); |
| 103 this._defaultFocusAsync = null; | 98 this._defaultFocusAsync = null; |
| 104 } | 99 } |
| 105 var item = this._valueToItem(value); | 100 var item = this._valueToItem(value); |
| 101 if (item && item.hasAttribute('disabled')) return; |
| 106 this._setFocusedItem(item); | 102 this._setFocusedItem(item); |
| 107 Polymer.IronMultiSelectableBehaviorImpl.select.apply(this, arguments); | 103 Polymer.IronMultiSelectableBehaviorImpl.select.apply(this, arguments); |
| 108 }, | 104 }, |
| 109 | 105 |
| 110 _onFocus: function(event) { | 106 _onFocus: function(event) { |
| 111 if (Polymer.IronMenuBehaviorImpl._shiftTabPressed) { | 107 if (Polymer.IronMenuBehaviorImpl._shiftTabPressed) { |
| 112 return; | 108 return; |
| 113 } | 109 } |
| 114 // do not focus the menu itself | 110 // do not focus the menu itself |
| 115 this.blur(); | 111 this.blur(); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 }; | 183 }; |
| 188 | 184 |
| 189 Polymer.IronMenuBehaviorImpl._shiftTabPressed = false; | 185 Polymer.IronMenuBehaviorImpl._shiftTabPressed = false; |
| 190 | 186 |
| 191 /** @polymerBehavior Polymer.IronMenuBehavior */ | 187 /** @polymerBehavior Polymer.IronMenuBehavior */ |
| 192 Polymer.IronMenuBehavior = [ | 188 Polymer.IronMenuBehavior = [ |
| 193 Polymer.IronMultiSelectableBehavior, | 189 Polymer.IronMultiSelectableBehavior, |
| 194 Polymer.IronA11yKeysBehavior, | 190 Polymer.IronA11yKeysBehavior, |
| 195 Polymer.IronMenuBehaviorImpl | 191 Polymer.IronMenuBehaviorImpl |
| 196 ]; | 192 ]; |
| OLD | NEW |