makeup-focusables
Advanced tools
Comparing version 0.0.5 to 0.1.0
18
index.js
@@ -8,2 +8,18 @@ 'use strict'; | ||
var keyboardOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
var callback = arguments.length > 2 ? arguments[2] : undefined; | ||
if (callback) { | ||
var request = requestAnimationFrame(function () { | ||
callback(getFocusables(el, keyboardOnly)); | ||
}); | ||
return function () { | ||
cancelAnimationFrame(request); | ||
}; | ||
} | ||
return getFocusables(el, keyboardOnly); | ||
}; | ||
function getFocusables(el) { | ||
var keyboardOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
var focusableEls = Array.prototype.slice.call(el.querySelectorAll(focusableElSelector)); // filter out elements with display: none | ||
@@ -22,2 +38,2 @@ | ||
return focusableEls; | ||
}; | ||
} |
{ | ||
"name": "makeup-focusables", | ||
"description": "Returns an array of all focusable descendants of the given element", | ||
"version": "0.0.5", | ||
"version": "0.1.0", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/makeup/makeup-js/tree/master/packages/makeup-focusables", |
@@ -54,4 +54,5 @@ # makeup-focusables | ||
* `keyboardOnly`: return only elements focusable in sequential keyboard navigation (default: false) | ||
* `callback`: if set, will call focusables after `requestAnimationFrame` and will pass the list of focusables in a callback method | ||
## Custom Events | ||
## Custom Events | ||
@@ -58,0 +59,0 @@ * None |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4596
34
67