react-focus-lock
Advanced tools
Comparing version 1.5.1 to 1.5.2
@@ -28,4 +28,4 @@ 'use strict'; | ||
AutoFocusInside.propTypes = { | ||
children: _propTypes2.default.node, | ||
disables: _propTypes2.default.bool | ||
children: _propTypes2.default.node.isRequired, | ||
disabled: _propTypes2.default.bool | ||
}; | ||
@@ -32,0 +32,0 @@ |
@@ -94,4 +94,3 @@ 'use strict'; | ||
!noFocusGuards && [_react2.default.createElement('div', { tabIndex: disabled ? -1 : 0, style: hidden }), // nearest focus guard | ||
_react2.default.createElement('div', { tabIndex: disabled ? -1 : 1, style: hidden }) // first tabbed element guard | ||
], | ||
_react2.default.createElement('div', { tabIndex: disabled ? -1 : 1, style: hidden })], | ||
_react2.default.createElement( | ||
@@ -98,0 +97,0 @@ 'div', |
@@ -52,3 +52,3 @@ 'use strict'; | ||
var onBlur = function onBlur() { | ||
setImmediate ? setImmediate(activateTrap) : setTimeout(activateTrap, 1); | ||
return setImmediate ? setImmediate(activateTrap) : setTimeout(activateTrap, 1); | ||
}; | ||
@@ -55,0 +55,0 @@ |
{ | ||
"name": "react-focus-lock", | ||
"version": "1.5.1", | ||
"version": "1.5.2", | ||
"description": "It is a trap! (for a focus)", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
# react-focus-lock | ||
[![CircleCI status](https://img.shields.io/circleci/project/github/theKashey/react-focus-lock/master.svg?style=flat-square)](https://circleci.com/gh/theKashey/react-focus-lock/tree/master) | ||
It is a trap! We got your focus and will not let him out! | ||
@@ -26,3 +29,3 @@ | ||
#WHY? | ||
# WHY? | ||
From [MDN Article about accessible dialogs](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_dialog_role): | ||
@@ -90,2 +93,5 @@ - The dialog must be properly labeled | ||
# Not only for React | ||
Uses [focus-lock](https://github.com/theKashey/focus-lock/) under the hood. It does also provide support for Vue.js and Vanilla DOM solutions | ||
# Licence | ||
@@ -92,0 +98,0 @@ MIT |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
const AutoFocusInside = ({disabled, children}) => ( | ||
const AutoFocusInside = ({ disabled, children }) => ( | ||
<div data-autofocus-inside={!disabled}> | ||
@@ -11,4 +11,4 @@ {children} | ||
AutoFocusInside.propTypes = { | ||
children: PropTypes.node, | ||
disables: PropTypes.bool, | ||
children: PropTypes.node.isRequired, | ||
disabled: PropTypes.bool, | ||
}; | ||
@@ -20,2 +20,2 @@ | ||
export default AutoFocusInside; | ||
export default AutoFocusInside; |
@@ -5,5 +5,5 @@ import FocusLock from './Lock'; | ||
export { | ||
AutoFocusInside | ||
AutoFocusInside, | ||
}; | ||
export default FocusLock; |
@@ -56,3 +56,3 @@ import React, { Component } from 'react'; | ||
<div tabIndex={disabled ? -1 : 0} style={hidden} />, // nearest focus guard | ||
<div tabIndex={disabled ? -1 : 1} style={hidden} /> // first tabbed element guard | ||
<div tabIndex={disabled ? -1 : 1} style={hidden} />, // first tabbed element guard | ||
]} | ||
@@ -59,0 +59,0 @@ <div |
@@ -29,7 +29,7 @@ import React from 'react'; | ||
const onBlur = () => { | ||
const onBlur = () => ( | ||
setImmediate | ||
? setImmediate(activateTrap) | ||
: setTimeout(activateTrap, 1) | ||
}; | ||
); | ||
@@ -36,0 +36,0 @@ const FocusTrap = ({ children }) => ( |
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
280507
24
99