focus-trap-react 8.8.0 → 8.8.1
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 +2 -1
- package/dist/focus-trap-react.js +2 -1
- package/package.json +1 -1
- package/src/focus-trap-react.js +4 -1
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.
|
|
@@ -205,6 +205,7 @@ In alphabetical order:
|
|
|
205
205
|
<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>
|
|
206
206
|
<td align="center"><a href="https://github.com/wandroll"><img src="https://avatars.githubusercontent.com/u/4492317?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Wandrille Verlut</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap-react/commits?author=wandroll" title="Code">💻</a> <a href="https://github.com/focus-trap/focus-trap-react/commits?author=wandroll" title="Tests">⚠️</a></td>
|
|
207
207
|
<td align="center"><a href="https://github.com/krikienoid"><img src="https://avatars3.githubusercontent.com/u/8528227?v=4?s=100" width="100px;" alt=""/><br /><sub><b>krikienoid</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap-react/issues?q=author%3Akrikienoid" title="Bug reports">🐛</a></td>
|
|
208
|
+
<td align="center"><a href="https://github.com/syntactic-salt"><img src="https://avatars.githubusercontent.com/u/9385662?v=4?s=100" width="100px;" alt=""/><br /><sub><b>syntactic-salt</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap-react/issues?q=author%3Asyntactic-salt" title="Bug reports">🐛</a></td>
|
|
208
209
|
</tr>
|
|
209
210
|
</table>
|
|
210
211
|
|
package/dist/focus-trap-react.js
CHANGED
|
@@ -129,7 +129,8 @@ var FocusTrap = /*#__PURE__*/function (_React$Component) {
|
|
|
129
129
|
}, {
|
|
130
130
|
key: "updatePreviousElement",
|
|
131
131
|
value: function updatePreviousElement() {
|
|
132
|
-
|
|
132
|
+
// SSR: careful to check if `document` exists before accessing it as a variable
|
|
133
|
+
var currentDocument = this.props.focusTrapOptions.document || (typeof document !== 'undefined' ? document : undefined);
|
|
133
134
|
|
|
134
135
|
if (currentDocument) {
|
|
135
136
|
this.previouslyFocusedElement = currentDocument.activeElement;
|
package/package.json
CHANGED
package/src/focus-trap-react.js
CHANGED
|
@@ -87,7 +87,10 @@ class FocusTrap extends React.Component {
|
|
|
87
87
|
|
|
88
88
|
/** Update the previously focused element with the currently focused element. */
|
|
89
89
|
updatePreviousElement() {
|
|
90
|
-
|
|
90
|
+
// SSR: careful to check if `document` exists before accessing it as a variable
|
|
91
|
+
const currentDocument =
|
|
92
|
+
this.props.focusTrapOptions.document ||
|
|
93
|
+
(typeof document !== 'undefined' ? document : undefined);
|
|
91
94
|
if (currentDocument) {
|
|
92
95
|
this.previouslyFocusedElement = currentDocument.activeElement;
|
|
93
96
|
}
|