makeup-roving-tabindex
Advanced tools
24
index.js
@@ -28,10 +28,2 @@ 'use strict'; | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } | ||
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } | ||
var NavigationEmitter = require('makeup-navigation-emitter'); | ||
@@ -45,2 +37,6 @@ | ||
var nodeListToArray = function nodeListToArray(nodeList) { | ||
return Array.prototype.slice.call(nodeList); | ||
}; | ||
function onModelMutation() { | ||
@@ -58,9 +54,7 @@ var modelIndex = this._navigationEmitter.model.index; | ||
var items = this._items; | ||
_toConsumableArray(items).filter(function (el, index) { | ||
return index !== e.detail.toIndex; | ||
nodeListToArray(items).filter(function (el, i) { | ||
return i !== e.detail.toIndex; | ||
}).forEach(function (el) { | ||
return el.setAttribute('tabindex', '-1'); | ||
}); | ||
items[e.detail.toIndex].setAttribute('tabindex', '0'); | ||
@@ -73,9 +67,7 @@ } | ||
var items = this._items; | ||
_toConsumableArray(items).filter(function (el, index) { | ||
return index !== e.detail.toIndex; | ||
nodeListToArray(items).filter(function (el, i) { | ||
return i !== e.detail.toIndex; | ||
}).forEach(function (el) { | ||
return el.setAttribute('tabindex', '-1'); | ||
}); | ||
items[e.detail.toIndex].setAttribute('tabindex', '0'); | ||
@@ -82,0 +74,0 @@ } |
{ | ||
"name": "makeup-roving-tabindex", | ||
"description": "Implements a roving tab index on given collection of elements", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/makeup-js/makeup-roving-tabindex.git", |
274127
-0.17%162
-0.61%