| Index: third_party/polymer/v1_0/components-chromium/iron-menu-behavior/iron-menu-behavior-extracted.js
|
| diff --git a/third_party/polymer/v1_0/components-chromium/iron-menu-behavior/iron-menu-behavior-extracted.js b/third_party/polymer/v1_0/components-chromium/iron-menu-behavior/iron-menu-behavior-extracted.js
|
| index e8b03e9e97eadee3c144ba4288ea6b96e92832d2..55c59dd672c345d63fae66bc3cf447dbbd6fe1f2 100644
|
| --- a/third_party/polymer/v1_0/components-chromium/iron-menu-behavior/iron-menu-behavior-extracted.js
|
| +++ b/third_party/polymer/v1_0/components-chromium/iron-menu-behavior/iron-menu-behavior-extracted.js
|
| @@ -112,7 +112,8 @@
|
| var attr = this.attrForItemTitle || 'textContent';
|
| var title = item[attr] || item.getAttribute(attr);
|
|
|
| - if (title && title.trim().charAt(0).toLowerCase() === String.fromCharCode(event.keyCode).toLowerCase()) {
|
| + if (!item.hasAttribute('disabled') && title &&
|
| + title.trim().charAt(0).toLowerCase() === String.fromCharCode(event.keyCode).toLowerCase()) {
|
| this._setFocusedItem(item);
|
| break;
|
| }
|
| @@ -121,21 +122,34 @@
|
|
|
| /**
|
| * Focuses the previous item (relative to the currently focused item) in the
|
| - * menu.
|
| + * menu, disabled items will be skipped.
|
| */
|
| _focusPrevious: function() {
|
| var length = this.items.length;
|
| - var index = (Number(this.indexOf(this.focusedItem)) - 1 + length) % length;
|
| - this._setFocusedItem(this.items[index]);
|
| + var curFocusIndex = Number(this.indexOf(this.focusedItem));
|
| + for (var i = 1; i < length; i++) {
|
| + var item = this.items[(curFocusIndex - i + length) % length];
|
| + if (!item.hasAttribute('disabled')) {
|
| + this._setFocusedItem(item);
|
| + return;
|
| + }
|
| + }
|
| },
|
|
|
| /**
|
| * Focuses the next item (relative to the currently focused item) in the
|
| - * menu.
|
| + * menu, disabled items will be skipped.
|
| */
|
| _focusNext: function() {
|
| - var index = (Number(this.indexOf(this.focusedItem)) + 1) % this.items.length;
|
| - this._setFocusedItem(this.items[index]);
|
| + var length = this.items.length;
|
| + var curFocusIndex = Number(this.indexOf(this.focusedItem));
|
| + for (var i = 1; i < length; i++) {
|
| + var item = this.items[(curFocusIndex + i) % length];
|
| + if (!item.hasAttribute('disabled')) {
|
| + this._setFocusedItem(item);
|
| + return;
|
| + }
|
| + }
|
| },
|
|
|
| /**
|
| @@ -244,7 +258,8 @@
|
| if (selectedItem) {
|
| this._setFocusedItem(selectedItem);
|
| } else if (this.items[0]) {
|
| - this._setFocusedItem(this.items[0]);
|
| + // We find the first none-disabled item (if one exists)
|
| + this._focusNext();
|
| }
|
| });
|
| },
|
|
|