Socket
Socket
Sign inDemoInstall

focus-lock

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

focus-lock - npm Package Compare versions

Comparing version 0.6.2 to 0.6.3

CHANGELOG.md

17

dist/cjs/focusMerge.js

@@ -28,2 +28,9 @@ 'use strict';

var isGuard = function isGuard(node) {
return node.dataset && node.dataset.focusGuard;
};
var notAGuard = function notAGuard(node) {
return !isGuard(node);
};
var newFocus = exports.newFocus = function newFocus(innerNodes, outerNodes, activeElement, lastNode, autoFocused) {

@@ -54,2 +61,6 @@ var cnt = innerNodes.length;

}
// first element
if (activeIndex <= firstNodeIndex && isGuard(activeElement) && Math.abs(indexDiff) > 1) {
return 0;
}
// jump out

@@ -105,6 +116,2 @@ if (indexDiff && Math.abs(indexDiff) > 1) {

var notAGuard = function notAGuard(node) {
return !(node.dataset && node.dataset.focusGuard);
};
var reorderNodes = function reorderNodes(srcNodes, dstNodes) {

@@ -138,3 +145,3 @@ return srcNodes.map(function (dnode) {

lockItem: innerElements.indexOf(node) >= 0,
guard: !notAGuard(node)
guard: isGuard(node)
};

@@ -141,0 +148,0 @@ });

@@ -12,2 +12,9 @@ import { getCommonParent, getTabbableNodes, getAllTabbableNodes, parentAutofocusables } from './utils/DOMutils';

var isGuard = function isGuard(node) {
return node.dataset && node.dataset.focusGuard;
};
var notAGuard = function notAGuard(node) {
return !isGuard(node);
};
export var newFocus = function newFocus(innerNodes, outerNodes, activeElement, lastNode, autoFocused) {

@@ -38,2 +45,6 @@ var cnt = innerNodes.length;

}
// first element
if (activeIndex <= firstNodeIndex && isGuard(activeElement) && Math.abs(indexDiff) > 1) {
return 0;
}
// jump out

@@ -89,6 +100,2 @@ if (indexDiff && Math.abs(indexDiff) > 1) {

var notAGuard = function notAGuard(node) {
return !(node.dataset && node.dataset.focusGuard);
};
var reorderNodes = function reorderNodes(srcNodes, dstNodes) {

@@ -122,3 +129,3 @@ return srcNodes.map(function (dnode) {

lockItem: innerElements.indexOf(node) >= 0,
guard: !notAGuard(node)
guard: isGuard(node)
};

@@ -125,0 +132,0 @@ });

{
"name": "focus-lock",
"version": "0.6.2",
"version": "0.6.3",
"description": "DOM trap for a focus",

@@ -17,3 +17,4 @@ "main": "dist/cjs/index.js",

"lint:fix": "eslint src tests --fix",
"size": "yarn size-limit"
"size": "yarn size-limit",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s"
},

@@ -30,3 +31,3 @@ "repository": {

"author": "theKashey <thekashey@gmail.com>",
"license": "ISC",
"license": "MIT",
"bugs": {

@@ -43,2 +44,3 @@ "url": "https://github.com/theKashey/focus-lock/issues"

"chai-enzyme": "^0.8.0",
"conventional-changelog-cli": "^2.0.12",
"enzyme": "^2.9.1",

@@ -45,0 +47,0 @@ "eslint": "^4.2.0",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc