focus-trap-react 8.8.1 → 8.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +3 -2
- package/dist/focus-trap-react.js +7 -2
- package/package.json +13 -13
- package/src/focus-trap-react.js +5 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# focus-trap-react [](https://github.com/focus-trap/focus-trap-react/actions?query=workflow:CI+branch:master) [](https://codecov.io/gh/focus-trap/focus-trap-react) [](./LICENSE)
|
|
2
2
|
|
|
3
3
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
4
|
-
[](#contributors)
|
|
5
5
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
6
6
|
|
|
7
7
|
A React component that traps focus.
|
|
@@ -191,15 +191,16 @@ In alphabetical order:
|
|
|
191
191
|
<td align="center"><a href="https://github.com/features/security"><img src="https://avatars1.githubusercontent.com/u/27347476?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Dependabot</b></sub></a><br /><a href="#maintenance-dependabot" title="Maintenance">🚧</a></td>
|
|
192
192
|
</tr>
|
|
193
193
|
<tr>
|
|
194
|
+
<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>
|
|
194
195
|
<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>
|
|
195
196
|
<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>
|
|
196
197
|
<td align="center"><a href="https://marais.io/"><img src="https://avatars2.githubusercontent.com/u/599459?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Marais Rossouw</b></sub></a><br /><a href="#infra-maraisr" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
|
|
197
198
|
<td align="center"><a href="https://github.com/liunate"><img src="https://avatars2.githubusercontent.com/u/38996291?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nate Liu</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap-react/commits?author=liunate" title="Tests">⚠️</a></td>
|
|
198
199
|
<td align="center"><a href="https://www.linkedin.com/in/rivajunior/"><img src="https://avatars1.githubusercontent.com/u/11370172?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Rivaldo Junior</b></sub></a><br /><a href="#maintenance-rivajunior" title="Maintenance">🚧</a></td>
|
|
199
200
|
<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>
|
|
200
|
-
<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>
|
|
201
201
|
</tr>
|
|
202
202
|
<tr>
|
|
203
|
+
<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>
|
|
203
204
|
<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>
|
|
204
205
|
<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>
|
|
205
206
|
<td align="center"><a href="http://tylerhawkins.info/201R/"><img src="https://avatars0.githubusercontent.com/u/13806458?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tyler Hawkins</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap-react/commits?author=thawkin3" title="Documentation">📖</a> <a href="#example-thawkin3" title="Examples">💡</a> <a href="https://github.com/focus-trap/focus-trap-react/commits?author=thawkin3" title="Tests">⚠️</a> <a href="#tool-thawkin3" title="Tools">🔧</a></td>
|
package/dist/focus-trap-react.js
CHANGED
|
@@ -141,7 +141,10 @@ var FocusTrap = /*#__PURE__*/function (_React$Component) {
|
|
|
141
141
|
value: function deactivateTrap() {
|
|
142
142
|
var _this2 = this;
|
|
143
143
|
|
|
144
|
-
var
|
|
144
|
+
var _this$tailoredFocusTr = this.tailoredFocusTrapOptions,
|
|
145
|
+
checkCanReturnFocus = _this$tailoredFocusTr.checkCanReturnFocus,
|
|
146
|
+
_this$tailoredFocusTr2 = _this$tailoredFocusTr.preventScroll,
|
|
147
|
+
preventScroll = _this$tailoredFocusTr2 === void 0 ? false : _this$tailoredFocusTr2;
|
|
145
148
|
|
|
146
149
|
if (this.focusTrap) {
|
|
147
150
|
// NOTE: we never let the trap return the focus since we do that ourselves
|
|
@@ -157,7 +160,9 @@ var FocusTrap = /*#__PURE__*/function (_React$Component) {
|
|
|
157
160
|
|
|
158
161
|
if (canReturnFocus) {
|
|
159
162
|
/** Returns focus to the element that had focus when the trap was activated. */
|
|
160
|
-
returnFocusNode.focus(
|
|
163
|
+
returnFocusNode.focus({
|
|
164
|
+
preventScroll: preventScroll
|
|
165
|
+
});
|
|
161
166
|
}
|
|
162
167
|
|
|
163
168
|
if (_this2.onPostDeactivate) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "focus-trap-react",
|
|
3
|
-
"version": "8.8.
|
|
3
|
+
"version": "8.8.2",
|
|
4
4
|
"description": "A React component that traps focus.",
|
|
5
5
|
"main": "dist/focus-trap-react.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -56,31 +56,31 @@
|
|
|
56
56
|
"homepage": "https://github.com/focus-trap/focus-trap-react#readme",
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@babel/cli": "^7.15.7",
|
|
59
|
-
"@babel/core": "^7.15.
|
|
59
|
+
"@babel/core": "^7.15.8",
|
|
60
60
|
"@babel/plugin-proposal-class-properties": "^7.12.13",
|
|
61
|
-
"@babel/preset-env": "^7.15.
|
|
61
|
+
"@babel/preset-env": "^7.15.8",
|
|
62
62
|
"@babel/preset-react": "^7.14.5",
|
|
63
63
|
"@changesets/cli": "^2.17.0",
|
|
64
64
|
"@testing-library/cypress": "^8.0.1",
|
|
65
|
-
"@testing-library/dom": "^8.
|
|
65
|
+
"@testing-library/dom": "^8.7.2",
|
|
66
66
|
"@testing-library/jest-dom": "^5.14.1",
|
|
67
|
-
"@testing-library/react": "^12.1.
|
|
68
|
-
"@testing-library/user-event": "^13.
|
|
69
|
-
"@types/jquery": "^3.5.
|
|
67
|
+
"@testing-library/react": "^12.1.2",
|
|
68
|
+
"@testing-library/user-event": "^13.3.0",
|
|
69
|
+
"@types/jquery": "^3.5.7",
|
|
70
70
|
"all-contributors-cli": "^6.20.0",
|
|
71
71
|
"babel-eslint": "^10.1.0",
|
|
72
|
-
"babel-jest": "^27.2.
|
|
72
|
+
"babel-jest": "^27.2.5",
|
|
73
73
|
"babelify": "^10.0.0",
|
|
74
74
|
"browserify": "^17.0.0",
|
|
75
75
|
"budo": "^11.6.4",
|
|
76
|
-
"cypress": "^8.
|
|
76
|
+
"cypress": "^8.6.0",
|
|
77
77
|
"cypress-plugin-tab": "^1.0.5",
|
|
78
78
|
"eslint": "^7.32.0",
|
|
79
79
|
"eslint-config-prettier": "^8.3.0",
|
|
80
80
|
"eslint-plugin-cypress": "^2.12.1",
|
|
81
|
-
"eslint-plugin-react": "^7.26.
|
|
82
|
-
"jest": "^27.2.
|
|
83
|
-
"jest-watch-typeahead": "^0.
|
|
81
|
+
"eslint-plugin-react": "^7.26.1",
|
|
82
|
+
"jest": "^27.2.5",
|
|
83
|
+
"jest-watch-typeahead": "^1.0.0",
|
|
84
84
|
"onchange": "^7.1.0",
|
|
85
85
|
"prettier": "^2.4.1",
|
|
86
86
|
"prop-types": "^15.7.2",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"react-dom": "^17.0.2",
|
|
89
89
|
"regenerator-runtime": "^0.13.9",
|
|
90
90
|
"start-server-and-test": "^1.14.0",
|
|
91
|
-
"typescript": "^4.4.
|
|
91
|
+
"typescript": "^4.4.4"
|
|
92
92
|
},
|
|
93
93
|
"dependencies": {
|
|
94
94
|
"focus-trap": "^6.7.1"
|
package/src/focus-trap-react.js
CHANGED
|
@@ -97,7 +97,8 @@ class FocusTrap extends React.Component {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
deactivateTrap() {
|
|
100
|
-
const { checkCanReturnFocus } =
|
|
100
|
+
const { checkCanReturnFocus, preventScroll = false } =
|
|
101
|
+
this.tailoredFocusTrapOptions;
|
|
101
102
|
|
|
102
103
|
if (this.focusTrap) {
|
|
103
104
|
// NOTE: we never let the trap return the focus since we do that ourselves
|
|
@@ -111,7 +112,9 @@ class FocusTrap extends React.Component {
|
|
|
111
112
|
|
|
112
113
|
if (canReturnFocus) {
|
|
113
114
|
/** Returns focus to the element that had focus when the trap was activated. */
|
|
114
|
-
returnFocusNode.focus(
|
|
115
|
+
returnFocusNode.focus({
|
|
116
|
+
preventScroll,
|
|
117
|
+
});
|
|
115
118
|
}
|
|
116
119
|
|
|
117
120
|
if (this.onPostDeactivate) {
|