focus-lock
Advanced tools
Comparing version 0.6.1 to 0.6.2
@@ -61,3 +61,3 @@ 'use strict'; | ||
var getTabbableNodes = exports.getTabbableNodes = function getTabbableNodes(topNodes, withGuards) { | ||
return (0, _tabOrder.orderByTabIndex)(filterFocusable((0, _tabUtils.getFocusables)(topNodes, withGuards)), true); | ||
return (0, _tabOrder.orderByTabIndex)(filterFocusable((0, _tabUtils.getFocusables)(topNodes, withGuards)), true, withGuards); | ||
}; | ||
@@ -64,0 +64,0 @@ |
@@ -22,3 +22,3 @@ 'use strict'; | ||
var orderByTabIndex = exports.orderByTabIndex = function orderByTabIndex(nodes, filterNegative) { | ||
var orderByTabIndex = exports.orderByTabIndex = function orderByTabIndex(nodes, filterNegative, keepGuards) { | ||
return (0, _array.toArray)(nodes).map(function (node, index) { | ||
@@ -28,3 +28,3 @@ return { | ||
index: index, | ||
tabIndex: node.tabIndex === -1 ? (node.dataset || {}).focusGuard ? 0 : -1 : node.tabIndex | ||
tabIndex: keepGuards && node.tabIndex === -1 ? (node.dataset || {}).focusGuard ? 0 : -1 : node.tabIndex | ||
}; | ||
@@ -31,0 +31,0 @@ }).filter(function (data) { |
@@ -52,3 +52,3 @@ import { orderByTabIndex } from './tabOrder'; | ||
export var getTabbableNodes = function getTabbableNodes(topNodes, withGuards) { | ||
return orderByTabIndex(filterFocusable(getFocusables(topNodes, withGuards)), true); | ||
return orderByTabIndex(filterFocusable(getFocusables(topNodes, withGuards)), true, withGuards); | ||
}; | ||
@@ -55,0 +55,0 @@ |
@@ -15,3 +15,3 @@ import { toArray } from './array'; | ||
export var orderByTabIndex = function orderByTabIndex(nodes, filterNegative) { | ||
export var orderByTabIndex = function orderByTabIndex(nodes, filterNegative, keepGuards) { | ||
return toArray(nodes).map(function (node, index) { | ||
@@ -21,3 +21,3 @@ return { | ||
index: index, | ||
tabIndex: node.tabIndex === -1 ? (node.dataset || {}).focusGuard ? 0 : -1 : node.tabIndex | ||
tabIndex: keepGuards && node.tabIndex === -1 ? (node.dataset || {}).focusGuard ? 0 : -1 : node.tabIndex | ||
}; | ||
@@ -24,0 +24,0 @@ }).filter(function (data) { |
{ | ||
"name": "focus-lock", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"description": "DOM trap for a focus", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
334926