Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-focus-lock

Package Overview
Dependencies
Maintainers
1
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-focus-lock - npm Package Compare versions

Comparing version 2.8.0 to 2.8.1

16

dist/cjs/Trap.js

@@ -100,2 +100,14 @@ "use strict";

var checkInHost = function checkInHost(check, el, boundary) {
return el // find host equal to active element and check nested active element
&& (el.host === check && (!el.activeElement || boundary.contains(el.activeElement)) // dive up
|| el.parentNode && checkInHost(check, el.parentNode, boundary));
};
var withinHost = function withinHost(activeElement, workingArea) {
return workingArea.some(function (area) {
return checkInHost(activeElement, area, area);
});
};
var activateTrap = function activateTrap() {

@@ -120,3 +132,5 @@ var result = false;

if (persistentFocus || focusWasOutside(crossFrame) || !isFreeFocus() || !lastActiveFocus && autoFocus) {
if (workingNode && !((0, _focusLock.focusInside)(workingArea) || focusIsPortaledPair(activeElement, workingNode))) {
if (workingNode && !( // active element is "inside" working area
(0, _focusLock.focusInside)(workingArea) || // check for shadow-dom contained elements
activeElement && withinHost(activeElement, workingArea) || focusIsPortaledPair(activeElement, workingNode))) {
if (document && !lastActiveFocus && activeElement && !autoFocus) {

@@ -123,0 +137,0 @@ // Check if blur() exists, which is missing on certain elements on IE

@@ -82,2 +82,14 @@ import * as React from 'react';

var checkInHost = function checkInHost(check, el, boundary) {
return el // find host equal to active element and check nested active element
&& (el.host === check && (!el.activeElement || boundary.contains(el.activeElement)) // dive up
|| el.parentNode && checkInHost(check, el.parentNode, boundary));
};
var withinHost = function withinHost(activeElement, workingArea) {
return workingArea.some(function (area) {
return checkInHost(activeElement, area, area);
});
};
var activateTrap = function activateTrap() {

@@ -102,3 +114,5 @@ var result = false;

if (persistentFocus || focusWasOutside(crossFrame) || !isFreeFocus() || !lastActiveFocus && autoFocus) {
if (workingNode && !(focusInside(workingArea) || focusIsPortaledPair(activeElement, workingNode))) {
if (workingNode && !( // active element is "inside" working area
focusInside(workingArea) || // check for shadow-dom contained elements
activeElement && withinHost(activeElement, workingArea) || focusIsPortaledPair(activeElement, workingNode))) {
if (document && !lastActiveFocus && activeElement && !autoFocus) {

@@ -105,0 +119,0 @@ // Check if blur() exists, which is missing on certain elements on IE

8

package.json
{
"name": "react-focus-lock",
"version": "2.8.0",
"version": "2.8.1",
"description": "It is a trap! (for a focus)",

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

"test": "npm run test:pick -- '_tests/**/*spec.js'",
"test:pick": "NODE_ENV=cjs mocha --require @babel/register --require jsdom-global/register --require _tests/spinup/scaffolding --exit",
"test:pick": "NODE_ENV=cjs mocha --require @babel/register --require global-jsdom/register --require _tests/spinup/scaffolding --exit",
"prepublish": "npm run lint:fix && npm run build && npm run changelog",

@@ -83,4 +83,4 @@ "lint": "eslint src",

"eslint-plugin-react": "^7.13.0",
"jsdom": "15.1.1",
"jsdom-global": "^3.0.2",
"jsdom": "^16.0.0",
"global-jsdom": "^8.4.0",
"material-ui": "^0.20.0",

@@ -87,0 +87,0 @@ "mocha": "^8.3.2",

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