@thecb/components 7.0.0-beta.0 → 7.0.0-beta.11
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/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { Fragment, useContext } from "react";
|
|
1
|
+
import React, { Fragment, useContext, useRef } from "react";
|
|
2
2
|
import { ThemeContext } from "styled-components";
|
|
3
3
|
import AriaModal from "react-aria-modal";
|
|
4
4
|
import { WHITE, ATHENS_GREY, SILVER_GREY } from "../../../constants/colors";
|
|
@@ -47,11 +47,15 @@ const Modal = ({
|
|
|
47
47
|
children
|
|
48
48
|
}) => {
|
|
49
49
|
const { isMobile } = useContext(ThemeContext);
|
|
50
|
+
const modalContainerRef = useRef(null);
|
|
50
51
|
return (
|
|
51
|
-
<
|
|
52
|
+
<div ref={modalContainerRef}>
|
|
52
53
|
{modalOpen && (
|
|
53
54
|
<AriaModal
|
|
54
|
-
|
|
55
|
+
// fallback to resolve Jest unit test errors when tabbable doesn't exist in jsdom https://github.com/focus-trap/focus-trap-react/issues/91
|
|
56
|
+
focusTrapOptions={{
|
|
57
|
+
fallbackFocus: modalContainerRef?.current
|
|
58
|
+
}}
|
|
55
59
|
onExit={onExit}
|
|
56
60
|
getApplicationNode={getApplicationNode}
|
|
57
61
|
titleText={modalHeaderText}
|
|
@@ -189,7 +193,7 @@ const Modal = ({
|
|
|
189
193
|
</AriaModal>
|
|
190
194
|
)}
|
|
191
195
|
{children}
|
|
192
|
-
</
|
|
196
|
+
</div>
|
|
193
197
|
);
|
|
194
198
|
};
|
|
195
199
|
|