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.0.4 to 2.0.5

2

dist/es2015/AutoFocusInside.js

@@ -1,2 +0,2 @@

import _extends from "@babel/runtime/helpers/extends";
import _extends from "@babel/runtime/helpers/esm/extends";
import React from 'react';

@@ -3,0 +3,0 @@ import PropTypes from 'prop-types';

@@ -1,3 +0,3 @@

import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
import _extends from "@babel/runtime/helpers/esm/extends";
import React from 'react';

@@ -4,0 +4,0 @@ import FocusLockUI from './Lock';

@@ -1,2 +0,2 @@

import _extends from "@babel/runtime/helpers/extends";
import _extends from "@babel/runtime/helpers/esm/extends";
import React from 'react';

@@ -3,0 +3,0 @@ import PropTypes from 'prop-types';

@@ -1,2 +0,2 @@

import _extends from "@babel/runtime/helpers/extends";
import _extends from "@babel/runtime/helpers/esm/extends";
import React, { useState, useRef, useCallback } from 'react';

@@ -3,0 +3,0 @@ import { node, bool, string, any, arrayOf, oneOfType, object, func } from 'prop-types';

@@ -1,2 +0,2 @@

import _extends from "@babel/runtime/helpers/extends";
import _extends from "@babel/runtime/helpers/esm/extends";
import React from 'react';

@@ -3,0 +3,0 @@ import PropTypes from 'prop-types';

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

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

"prop-types": "^15.6.2",
"react-clientside-effect": "^1.2.1",
"react-clientside-effect": "^1.2.2",
"use-sidecar": "^1.0.1"
}
}

@@ -75,3 +75,3 @@ <div align="left">

This is expected behavior for Modals, but it is better to implement it by your self.
This is expected behavior for Modals, but it is better to implement it by your self. See [unmounting and focus management](https://github.com/theKashey/react-focus-lock#unmounting-and-focus-management) for details
- `persistentFocus=false`, requires any element to be focused. This also disables text selections inside, and __outside__ focus lock.

@@ -253,7 +253,20 @@ - `autoFocus=true`, enables or disables focusing into on Lock activation. If disabled Lock will blur an active focus.

# Unmounting and focus management
- In case FocusLock has `returnFocus` enabled, and it's gonna to be unmounted - focus will be returned after zero-timeout.
- In case `returnFocus` did not set, and you are going to control focus change by your own - keep in mind
- In case FocusLock has `returnFocus` enabled, and it's going to be unmounted - focus will be returned after zero-timeout.
- In case `returnFocus` is set to `false`, and you are going to control focus change on your own - keep in mind
>> React will first call Parent.componentWillUnmount, and next Child.componentWillUnmount
Thus means - Trap will be still active, be the time you _may_ want move(return) focus on componentWillUnmount. Please deffer this action with a zero-timeout.
This means - Trap will be still active by the time you _may_ want move(return) focus on componentWillUnmount. Please deffer this action with a zero-timeout.
Similarly, if you are using the `disabled` prop to control FocusLock, you will need a zero-timeout to correctly restore focus.
```
<FocusLock
disabled={isFocusLockDisabled}
onDeactivation={() => {
// Without the zero-timeout, focus will likely remain on the button/control
// you used to set isFocusLockDisabled = true
window.setTimeout(() => myRef.current.focus(), 0);
}
>
```

@@ -260,0 +273,0 @@ # Not only for React

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