update components

This commit is contained in:
Luke Pulverenti 2016-07-07 14:12:08 -04:00
parent b4e32e14d4
commit 91127df6f0
21 changed files with 65 additions and 35 deletions

View file

@ -139,11 +139,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* Focuses the previous item (relative to the currently focused item) in the
* menu, disabled items will be skipped.
* Loop until length + 1 to handle case of single item in menu.
*/
_focusPrevious: function() {
var length = this.items.length;
var curFocusIndex = Number(this.indexOf(this.focusedItem));
for (var i = 1; i < length; i++) {
for (var i = 1; i < length + 1; i++) {
var item = this.items[(curFocusIndex - i + length) % length];
if (!item.hasAttribute('disabled')) {
this._setFocusedItem(item);
@ -155,11 +156,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* Focuses the next item (relative to the currently focused item) in the
* menu, disabled items will be skipped.
* Loop until length + 1 to handle case of single item in menu.
*/
_focusNext: function() {
var length = this.items.length;
var curFocusIndex = Number(this.indexOf(this.focusedItem));
for (var i = 1; i < length; i++) {
for (var i = 1; i < length + 1; i++) {
var item = this.items[(curFocusIndex + i) % length];
if (!item.hasAttribute('disabled')) {
this._setFocusedItem(item);