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.6.0 to 2.7.0

14

dist/cjs/Lock.js

@@ -66,2 +66,3 @@ "use strict";

shouldReturnFocus = props.returnFocus,
focusOptions = props.focusOptions,
onActivationCallback = props.onActivation,

@@ -105,3 +106,3 @@ onDeactivationCallback = props.onDeactivation;

if (Boolean(howToReturnFocus)) {
var focusOptions = (0, _typeof2["default"])(howToReturnFocus) === 'object' ? howToReturnFocus : undefined;
var returnFocusOptions = (0, _typeof2["default"])(howToReturnFocus) === 'object' ? howToReturnFocus : undefined;
originalFocusedElement.current = null;

@@ -113,6 +114,6 @@

Promise.resolve().then(function () {
return returnFocusTo.focus(focusOptions);
return returnFocusTo.focus(returnFocusOptions);
});
} else {
returnFocusTo.focus(focusOptions);
returnFocusTo.focus(returnFocusOptions);
}

@@ -183,3 +184,4 @@ }

onDeactivation: onDeactivation,
returnFocus: returnFocus
returnFocus: returnFocus,
focusOptions: focusOptions
}), /*#__PURE__*/React.createElement(Container, (0, _extends2["default"])({

@@ -200,3 +202,4 @@ ref: mergedRef

disabled: _propTypes.bool,
returnFocus: (0, _propTypes.oneOfType)([_propTypes.bool, _propTypes.object]),
returnFocus: (0, _propTypes.oneOfType)([_propTypes.bool, _propTypes.object, _propTypes.func]),
focusOptions: _propTypes.object,
noFocusGuards: _propTypes.bool,

@@ -221,2 +224,3 @@ allowTextSelection: _propTypes.bool,

returnFocus: false,
focusOptions: undefined,
noFocusGuards: false,

@@ -223,0 +227,0 @@ autoFocus: true,

@@ -109,3 +109,4 @@ "use strict";

shards = _lastActiveTrap.shards,
crossFrame = _lastActiveTrap.crossFrame;
crossFrame = _lastActiveTrap.crossFrame,
focusOptions = _lastActiveTrap.focusOptions;
var workingNode = observed || lastPortaledElement && lastPortaledElement.portaledElement;

@@ -128,3 +129,5 @@ var activeElement = document && document.activeElement;

} else {
result = (0, _focusLock["default"])(workingArea, lastActiveFocus);
result = (0, _focusLock["default"])(workingArea, lastActiveFocus, {
focusOptions: focusOptions
});
lastPortaledElement = {};

@@ -131,0 +134,0 @@ }

@@ -38,2 +38,3 @@ import _extends from "@babel/runtime/helpers/esm/extends";

shouldReturnFocus = props.returnFocus,
focusOptions = props.focusOptions,
onActivationCallback = props.onActivation,

@@ -76,3 +77,3 @@ onDeactivationCallback = props.onDeactivation;

if (Boolean(howToReturnFocus)) {
var focusOptions = typeof howToReturnFocus === 'object' ? howToReturnFocus : undefined;
var returnFocusOptions = typeof howToReturnFocus === 'object' ? howToReturnFocus : undefined;
originalFocusedElement.current = null;

@@ -84,6 +85,6 @@

Promise.resolve().then(function () {
return returnFocusTo.focus(focusOptions);
return returnFocusTo.focus(returnFocusOptions);
});
} else {
returnFocusTo.focus(focusOptions);
returnFocusTo.focus(returnFocusOptions);
}

@@ -154,3 +155,4 @@ }

onDeactivation: onDeactivation,
returnFocus: returnFocus
returnFocus: returnFocus,
focusOptions: focusOptions
}), /*#__PURE__*/React.createElement(Container, _extends({

@@ -171,3 +173,4 @@ ref: mergedRef

disabled: bool,
returnFocus: oneOfType([bool, object]),
returnFocus: oneOfType([bool, object, func]),
focusOptions: object,
noFocusGuards: bool,

@@ -192,2 +195,3 @@ allowTextSelection: bool,

returnFocus: false,
focusOptions: undefined,
noFocusGuards: false,

@@ -194,0 +198,0 @@ autoFocus: true,

@@ -91,3 +91,4 @@ import * as React from 'react';

shards = _lastActiveTrap.shards,
crossFrame = _lastActiveTrap.crossFrame;
crossFrame = _lastActiveTrap.crossFrame,
focusOptions = _lastActiveTrap.focusOptions;
var workingNode = observed || lastPortaledElement && lastPortaledElement.portaledElement;

@@ -110,3 +111,5 @@ var activeElement = document && document.activeElement;

} else {
result = moveFocusInside(workingArea, lastActiveFocus);
result = moveFocusInside(workingArea, lastActiveFocus, {
focusOptions: focusOptions
});
lastPortaledElement = {};

@@ -113,0 +116,0 @@ }

@@ -18,2 +18,15 @@ import * as React from 'react';

/**
* used to control behavior or "returning focus back to the lock"
*
* @deprecated Can lead to a wrong user experience. Use this option only if you known what you are doing
* @see {@link https://github.com/theKashey/react-focus-lock/issues/162}
* @example
* prevent scroll example
* ```tsx
* <FocusLock focusOptions={{preventScroll: true}} />
* ```
*/
focusOptions?: FocusOptions;
/**
* @deprecated Use persistentFocus=false instead

@@ -20,0 +33,0 @@ * enables(or disables) text selection. This also allows not to have ANY focus.

{
"name": "react-focus-lock",
"version": "2.6.0",
"version": "2.7.0",
"description": "It is a trap! (for a focus)",

@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js",

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