makeup-roving-tabindex
Advanced tools
Comparing version 0.2.3 to 0.3.0
30
index.js
@@ -43,4 +43,3 @@ 'use strict'; | ||
var modelIndex = this._navigationEmitter.model.index; | ||
this._items.forEach(function (el, index) { | ||
this.filteredItems.forEach(function (el, index) { | ||
return el.setAttribute('tabindex', index !== modelIndex ? '-1' : '0'); | ||
@@ -51,5 +50,3 @@ }); | ||
function onModelInit(e) { | ||
this._index = e.detail.toIndex; // seems unused internally. scheduled for deletion. | ||
var items = this._items; | ||
var items = e.detail.items; | ||
nodeListToArray(items).filter(function (el, i) { | ||
@@ -66,3 +63,3 @@ return i !== e.detail.toIndex; | ||
var items = this._items; | ||
var items = this.filteredItems; | ||
nodeListToArray(items).filter(function (el, i) { | ||
@@ -77,3 +74,3 @@ return i !== e.detail.toIndex; | ||
function onModelChange(e) { | ||
var items = this._items; | ||
var items = this.filteredItems; | ||
var fromItem = items[e.detail.fromIndex]; | ||
@@ -159,2 +156,7 @@ var toItem = items[e.detail.toIndex]; | ||
_createClass(LinearRovingTabindex, [{ | ||
key: "reset", | ||
value: function reset() { | ||
this._navigationEmitter.model.reset(); | ||
} | ||
}, { | ||
key: "destroy", | ||
@@ -176,3 +178,13 @@ value: function destroy() { | ||
this._navigationEmitter.model.options.wrap = newWrap; | ||
} // we cannot use a cached version of the items in question since the DOM may change without notice | ||
} | ||
}, { | ||
key: "filteredItems", | ||
get: function get() { | ||
return this._navigationEmitter.model.filteredItems; | ||
} | ||
}, { | ||
key: "items", | ||
get: function get() { | ||
return this._navigationEmitter.model.items; | ||
} // backwards compat | ||
@@ -182,3 +194,3 @@ }, { | ||
get: function get() { | ||
return this._el.querySelectorAll(this._itemSelector); | ||
return this.items; | ||
} | ||
@@ -185,0 +197,0 @@ }]); |
{ | ||
"name": "makeup-roving-tabindex", | ||
"description": "Implements a roving tab index on given collection of elements", | ||
"version": "0.2.3", | ||
"version": "0.3.0", | ||
"main": "index.js", | ||
@@ -41,7 +41,7 @@ "repository": "https://github.com/makeup-js/makeup-roving-tabindex.git", | ||
"coveralls": "^3", | ||
"eslint": "^5", | ||
"eslint": "^6", | ||
"eslint-config-ebay": "^1", | ||
"jasmine-core": "^3", | ||
"karma": "^4", | ||
"karma-chrome-launcher": "^2", | ||
"karma-chrome-launcher": "^3", | ||
"karma-coverage": "^1", | ||
@@ -51,3 +51,3 @@ "karma-html-reporter": "~0.2", | ||
"lasso-cli": "^2", | ||
"onchange": "^5", | ||
"onchange": "^6", | ||
"parallelshell": "^3", | ||
@@ -59,3 +59,3 @@ "puppeteer": "^1", | ||
"custom-event-polyfill": "^1", | ||
"makeup-navigation-emitter": "~0.2.2", | ||
"makeup-navigation-emitter": "~0.3.0", | ||
"nodelist-foreach-polyfill": "^1" | ||
@@ -62,0 +62,0 @@ }, |
@@ -79,6 +79,9 @@ # makeup-roving-tabindex | ||
* `filteredItems`: returns filtered items (e.g. non-hidden items) | ||
* `index`: the index position of the roving tabindex (i.e. the element with tabindex="0") | ||
* `items`: returns all items that match item selector | ||
## Methods | ||
* `reset`: will force a reset to the value specified by `autoReset` | ||
* `destroy`: destroys all event listeners | ||
@@ -85,0 +88,0 @@ |
Sorry, the diff of this file is not supported yet
289085
178
127
+ Addedmakeup-exit-emitter@0.2.6(transitive)
+ Addedmakeup-navigation-emitter@0.3.8(transitive)
+ Addedmakeup-next-id@0.1.3(transitive)
+ Addednanoid@2.1.11(transitive)
- Removedmakeup-exit-emitter@0.1.1(transitive)
- Removedmakeup-navigation-emitter@0.2.3(transitive)
- Removedmakeup-next-id@0.0.3(transitive)