makeup-focusables
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -6,2 +6,3 @@ var focusable = require('../index.js'); | ||
var appender2 = document.getElementById('appender2'); | ||
var appender3 = document.getElementById('appender3'); | ||
var output = document.getElementById('output'); | ||
@@ -17,4 +18,7 @@ | ||
listItem.setAttribute('tabindex', '0'); | ||
} else if (e.target.id === 'appender2') { | ||
listItem.setAttribute('tabindex', '-1'); | ||
} else { | ||
listItem.setAttribute('tabindex', '-1'); | ||
listItem.setAttribute('tabindex', '0'); | ||
listItem.setAttribute('hidden', 'hidden'); | ||
} | ||
@@ -31,1 +35,2 @@ | ||
appender2.addEventListener('click', onButtonClick); | ||
appender3.addEventListener('click', onButtonClick); |
@@ -594,3 +594,3 @@ /* | ||
$_mod.def("/makeup-focusables$0.0.1/index", function(require, exports, module, __filename, __dirname) { 'use strict'; | ||
$_mod.def("/makeup-focusables$0.0.2/index", function(require, exports, module, __filename, __dirname) { 'use strict'; | ||
@@ -606,2 +606,7 @@ var focusableElList = ['a[href]', 'area[href]', 'button:not([disabled])', 'embed', 'iframe', 'input:not([disabled])', 'object', 'select:not([disabled])', 'textarea:not([disabled])', '*[tabindex]', '*[contenteditable]']; | ||
// filter out elements with display: none | ||
focusableEls = focusableEls.filter(function (focusableEl) { | ||
return window.getComputedStyle(focusableEl).display !== 'none'; | ||
}); | ||
if (keyboardOnly === true) { | ||
@@ -617,3 +622,3 @@ focusableEls = focusableEls.filter(function (focusableEl) { | ||
}); | ||
$_mod.def("/makeup-focusables$0.0.1/docs/index", function(require, exports, module, __filename, __dirname) { var focusable = require('/makeup-focusables$0.0.1/index'/*'../index.js'*/); | ||
$_mod.def("/makeup-focusables$0.0.2/docs/index", function(require, exports, module, __filename, __dirname) { var focusable = require('/makeup-focusables$0.0.2/index'/*'../index.js'*/); | ||
@@ -623,2 +628,3 @@ var listEl = document.getElementById('list'); | ||
var appender2 = document.getElementById('appender2'); | ||
var appender3 = document.getElementById('appender3'); | ||
var output = document.getElementById('output'); | ||
@@ -634,4 +640,7 @@ | ||
listItem.setAttribute('tabindex', '0'); | ||
} else if (e.target.id === 'appender2') { | ||
listItem.setAttribute('tabindex', '-1'); | ||
} else { | ||
listItem.setAttribute('tabindex', '-1'); | ||
listItem.setAttribute('tabindex', '0'); | ||
listItem.setAttribute('hidden', 'hidden'); | ||
} | ||
@@ -648,4 +657,5 @@ | ||
appender2.addEventListener('click', onButtonClick); | ||
appender3.addEventListener('click', onButtonClick); | ||
}); | ||
$_mod.run("/makeup-focusables$0.0.1/docs/index"); | ||
$_mod.run("/makeup-focusables$0.0.2/docs/index"); |
@@ -12,2 +12,7 @@ 'use strict'; | ||
// filter out elements with display: none | ||
focusableEls = focusableEls.filter(function (focusableEl) { | ||
return window.getComputedStyle(focusableEl).display !== 'none'; | ||
}); | ||
if (keyboardOnly === true) { | ||
@@ -14,0 +19,0 @@ focusableEls = focusableEls.filter(function (focusableEl) { |
{ | ||
"name": "makeup-focusables", | ||
"description": "Returns an array of all focusable descendants of the given element", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"main": "index.js", | ||
@@ -12,3 +12,3 @@ "repository": "https://github.com/makeup-js/makeup-focusables.git", | ||
"test": "npm run transpile && npm run lasso:test && npm run clean && karma start --autoWatch false --singleRun true", | ||
"prepublishOnly": "npm run clean && npm run lint && npm run test && npm run build", | ||
"prepublishOnly": "npm run clean && npm run lint && npm run build && npm run test", | ||
"build": "npm run transpile && npm run lasso", | ||
@@ -15,0 +15,0 @@ "fix": "eslint src/index.js --fix", |
@@ -22,2 +22,7 @@ 'use strict'; | ||
// filter out elements with display: none | ||
focusableEls = focusableEls.filter(function(focusableEl) { | ||
return window.getComputedStyle(focusableEl).display !== 'none'; | ||
}); | ||
if (keyboardOnly === true) { | ||
@@ -24,0 +29,0 @@ focusableEls = focusableEls.filter(function(focusableEl) { |
@@ -76,2 +76,30 @@ describe("makeup-focusable", function() { | ||
describe('when element contains elements with tabindex, with hidden attribute', function() { | ||
var focusableEls; | ||
beforeAll(function() { | ||
body.innerHTML = '<div hidden tabindex="0"></div><div></div><div hidden tabindex="0"></div>'; | ||
focusableEls = focusable(body); | ||
}); | ||
it("should return zero elements", function() { | ||
expect(focusableEls.length).toBe(0); | ||
}); | ||
}); | ||
describe('when element contains elements with tabindex, with display:none', function() { | ||
var focusableEls; | ||
beforeAll(function() { | ||
body.innerHTML = '<div style="display:none" tabindex="0"></div>' + | ||
'<div></div>' + | ||
'<div style="display:none" tabindex="0"></div>'; | ||
focusableEls = focusable(body); | ||
}); | ||
it("should return zero elements", function() { | ||
expect(focusableEls.length).toBe(0); | ||
}); | ||
}); | ||
describe('when element contains elements with negative tabindex, with sequentialOnly set to true', function() { | ||
@@ -78,0 +106,0 @@ var focusableEls; |
@@ -1,2 +0,2 @@ | ||
$_mod.def("/makeup-focusables$0.0.1/index", function(require, exports, module, __filename, __dirname) { 'use strict'; | ||
$_mod.def("/makeup-focusables$0.0.2/index", function(require, exports, module, __filename, __dirname) { 'use strict'; | ||
@@ -12,2 +12,7 @@ var focusableElList = ['a[href]', 'area[href]', 'button:not([disabled])', 'embed', 'iframe', 'input:not([disabled])', 'object', 'select:not([disabled])', 'textarea:not([disabled])', '*[tabindex]', '*[contenteditable]']; | ||
// filter out elements with display: none | ||
focusableEls = focusableEls.filter(function (focusableEl) { | ||
return window.getComputedStyle(focusableEl).display !== 'none'; | ||
}); | ||
if (keyboardOnly === true) { | ||
@@ -14,0 +19,0 @@ focusableEls = focusableEls.filter(function (focusableEl) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
198610
786