focus-trap-react
Advanced tools
Comparing version 8.8.1 to 8.8.2
# Changelog | ||
## 8.8.2 | ||
### Patch Changes | ||
- 08a9449: Use `preventScroll` option on deactivation if returning focus. | ||
## 8.8.1 | ||
@@ -4,0 +10,0 @@ |
@@ -144,3 +144,6 @@ "use strict"; | ||
var checkCanReturnFocus = this.tailoredFocusTrapOptions.checkCanReturnFocus; | ||
var _this$tailoredFocusTr = this.tailoredFocusTrapOptions, | ||
checkCanReturnFocus = _this$tailoredFocusTr.checkCanReturnFocus, | ||
_this$tailoredFocusTr2 = _this$tailoredFocusTr.preventScroll, | ||
preventScroll = _this$tailoredFocusTr2 === void 0 ? false : _this$tailoredFocusTr2; | ||
@@ -161,3 +164,5 @@ if (this.focusTrap) { | ||
/** Returns focus to the element that had focus when the trap was activated. */ | ||
returnFocusNode.focus(); | ||
returnFocusNode.focus({ | ||
preventScroll: preventScroll | ||
}); | ||
} | ||
@@ -164,0 +169,0 @@ |
{ | ||
"name": "focus-trap-react", | ||
"version": "8.8.1", | ||
"version": "8.8.2", | ||
"description": "A React component that traps focus.", | ||
@@ -59,20 +59,20 @@ "main": "dist/focus-trap-react.js", | ||
"@babel/cli": "^7.15.7", | ||
"@babel/core": "^7.15.5", | ||
"@babel/core": "^7.15.8", | ||
"@babel/plugin-proposal-class-properties": "^7.12.13", | ||
"@babel/preset-env": "^7.15.6", | ||
"@babel/preset-env": "^7.15.8", | ||
"@babel/preset-react": "^7.14.5", | ||
"@changesets/cli": "^2.17.0", | ||
"@testing-library/cypress": "^8.0.1", | ||
"@testing-library/dom": "^8.5.0", | ||
"@testing-library/dom": "^8.7.2", | ||
"@testing-library/jest-dom": "^5.14.1", | ||
"@testing-library/react": "^12.1.0", | ||
"@testing-library/user-event": "^13.2.1", | ||
"@types/jquery": "^3.5.6", | ||
"@testing-library/react": "^12.1.2", | ||
"@testing-library/user-event": "^13.3.0", | ||
"@types/jquery": "^3.5.7", | ||
"all-contributors-cli": "^6.20.0", | ||
"babel-eslint": "^10.1.0", | ||
"babel-jest": "^27.2.1", | ||
"babel-jest": "^27.2.5", | ||
"babelify": "^10.0.0", | ||
"browserify": "^17.0.0", | ||
"budo": "^11.6.4", | ||
"cypress": "^8.4.1", | ||
"cypress": "^8.6.0", | ||
"cypress-plugin-tab": "^1.0.5", | ||
@@ -82,5 +82,5 @@ "eslint": "^7.32.0", | ||
"eslint-plugin-cypress": "^2.12.1", | ||
"eslint-plugin-react": "^7.26.0", | ||
"jest": "^27.2.1", | ||
"jest-watch-typeahead": "^0.6.4", | ||
"eslint-plugin-react": "^7.26.1", | ||
"jest": "^27.2.5", | ||
"jest-watch-typeahead": "^1.0.0", | ||
"onchange": "^7.1.0", | ||
@@ -93,3 +93,3 @@ "prettier": "^2.4.1", | ||
"start-server-and-test": "^1.14.0", | ||
"typescript": "^4.4.3" | ||
"typescript": "^4.4.4" | ||
}, | ||
@@ -96,0 +96,0 @@ "dependencies": { |
# focus-trap-react [![CI](https://github.com/focus-trap/focus-trap-react/workflows/CI/badge.svg?branch=master&event=push)](https://github.com/focus-trap/focus-trap-react/actions?query=workflow:CI+branch:master) [![Codecov](https://img.shields.io/codecov/c/github/focus-trap/focus-trap-react)](https://codecov.io/gh/focus-trap/focus-trap-react) [![license](https://badgen.now.sh/badge/license/MIT)](./LICENSE) | ||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-20-orange.svg?style=flat-square)](#contributors) | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-21-orange.svg?style=flat-square)](#contributors) | ||
<!-- ALL-CONTRIBUTORS-BADGE:END --> | ||
@@ -194,2 +194,3 @@ | ||
<tr> | ||
<td align="center"><a href="https://github.com/jhnns"><img src="https://avatars.githubusercontent.com/u/781746?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Johannes Ewald</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap-react/commits?author=jhnns" title="Code">💻</a></td> | ||
<td align="center"><a href="http://josuzuki.me"><img src="https://avatars1.githubusercontent.com/u/9583920?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jonathan Suzuki</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap-react/issues?q=author%3AJoSuzuki" title="Bug reports">🐛</a></td> | ||
@@ -201,5 +202,5 @@ <td align="center"><a href="http://kathleenmcmahon.dev/"><img src="https://avatars1.githubusercontent.com/u/11621935?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kathleen McMahon</b></sub></a><br /><a href="#maintenance-resource11" title="Maintenance">🚧</a></td> | ||
<td align="center"><a href="https://scottrippey.github.io/"><img src="https://avatars3.githubusercontent.com/u/430608?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Scott Rippey</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap-react/commits?author=scottrippey" title="Code">💻</a> <a href="https://github.com/focus-trap/focus-trap-react/issues?q=author%3Ascottrippey" title="Bug reports">🐛</a></td> | ||
<td align="center"><a href="https://seanmcp.com/"><img src="https://avatars1.githubusercontent.com/u/6360367?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sean McPherson</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap-react/commits?author=SeanMcP" title="Code">💻</a></td> | ||
</tr> | ||
<tr> | ||
<td align="center"><a href="https://seanmcp.com/"><img src="https://avatars1.githubusercontent.com/u/6360367?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sean McPherson</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap-react/commits?author=SeanMcP" title="Code">💻</a></td> | ||
<td align="center"><a href="https://recollectr.io"><img src="https://avatars2.githubusercontent.com/u/6835891?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Slapbox</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap-react/commits?author=Slapbox" title="Documentation">📖</a></td> | ||
@@ -206,0 +207,0 @@ <td align="center"><a href="https://stefancameron.com/"><img src="https://avatars3.githubusercontent.com/u/2855350?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Stefan Cameron</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap-react/commits?author=stefcameron" title="Code">💻</a> <a href="https://github.com/focus-trap/focus-trap-react/issues?q=author%3Astefcameron" title="Bug reports">🐛</a> <a href="#infra-stefcameron" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/focus-trap/focus-trap-react/commits?author=stefcameron" title="Tests">⚠️</a> <a href="https://github.com/focus-trap/focus-trap-react/commits?author=stefcameron" title="Documentation">📖</a> <a href="#maintenance-stefcameron" title="Maintenance">🚧</a></td> |
@@ -100,3 +100,4 @@ const React = require('react'); | ||
deactivateTrap() { | ||
const { checkCanReturnFocus } = this.tailoredFocusTrapOptions; | ||
const { checkCanReturnFocus, preventScroll = false } = | ||
this.tailoredFocusTrapOptions; | ||
@@ -115,3 +116,5 @@ if (this.focusTrap) { | ||
/** Returns focus to the element that had focus when the trap was activated. */ | ||
returnFocusNode.focus(); | ||
returnFocusNode.focus({ | ||
preventScroll, | ||
}); | ||
} | ||
@@ -118,0 +121,0 @@ |
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
55653
523
217