react-focus-lock
Advanced tools
Comparing version 2.0.4 to 2.0.5
@@ -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 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68985
323