focus-trap-react 4.0.0 → 4.0.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 +4 -0
- package/dist/focus-trap-react.js +5 -1
- package/package.json +1 -1
- package/src/focus-trap-react.js +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.0.1
|
|
4
|
+
|
|
5
|
+
- Fix bug that caused `returnFocusOnDeactivate: true` to be ignored when using the `active` prop to activate & deactivate the focus trap.
|
|
6
|
+
|
|
3
7
|
## 4.0.0
|
|
4
8
|
|
|
5
9
|
- Update focus-trap to 3.0.0, which includes [a couple of behavior changes](https://github.com/davidtheclark/focus-trap/blob/master/CHANGELOG.md#300). The key change is that focus management has been changed so that you can include tricky focusable elements like radio groups, iframes, and shadow DOM components in your trap — as long as the first and last focusable elements in the trap can still be detected by [Tabbable](https://github.com/davidtheclark/tabbable).
|
package/dist/focus-trap-react.js
CHANGED
|
@@ -61,7 +61,11 @@ var FocusTrap = function (_React$Component) {
|
|
|
61
61
|
key: 'componentDidUpdate',
|
|
62
62
|
value: function componentDidUpdate(prevProps) {
|
|
63
63
|
if (prevProps.active && !this.props.active) {
|
|
64
|
-
this.
|
|
64
|
+
var returnFocusOnDeactivate = this.props.focusTrapOptions.returnFocusOnDeactivate;
|
|
65
|
+
|
|
66
|
+
var returnFocus = returnFocusOnDeactivate || false;
|
|
67
|
+
var config = { returnFocus: returnFocus };
|
|
68
|
+
this.focusTrap.deactivate(config);
|
|
65
69
|
} else if (!prevProps.active && this.props.active) {
|
|
66
70
|
this.focusTrap.activate();
|
|
67
71
|
}
|
package/package.json
CHANGED
package/src/focus-trap-react.js
CHANGED
|
@@ -49,7 +49,10 @@ class FocusTrap extends React.Component {
|
|
|
49
49
|
|
|
50
50
|
componentDidUpdate(prevProps) {
|
|
51
51
|
if (prevProps.active && !this.props.active) {
|
|
52
|
-
this.
|
|
52
|
+
const { returnFocusOnDeactivate } = this.props.focusTrapOptions;
|
|
53
|
+
const returnFocus = returnFocusOnDeactivate || false;
|
|
54
|
+
const config = { returnFocus };
|
|
55
|
+
this.focusTrap.deactivate(config);
|
|
53
56
|
} else if (!prevProps.active && this.props.active) {
|
|
54
57
|
this.focusTrap.activate();
|
|
55
58
|
}
|