@thecb/components 7.0.0-beta.2 → 7.0.0-beta.3
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
|
@@ -47,13 +47,14 @@ const Modal = ({
|
|
|
47
47
|
children
|
|
48
48
|
}) => {
|
|
49
49
|
const { isMobile } = useContext(ThemeContext);
|
|
50
|
-
const
|
|
50
|
+
const bodyTextContainerRef = useRef(null);
|
|
51
|
+
|
|
51
52
|
return (
|
|
52
53
|
<Fragment>
|
|
53
54
|
{modalOpen && (
|
|
54
55
|
<AriaModal
|
|
55
|
-
initialFocus={
|
|
56
|
-
focusTrapOptions={{ delayInitialFocus:
|
|
56
|
+
initialFocus={bodyTextContainerRef}
|
|
57
|
+
focusTrapOptions={{ delayInitialFocus: true, fallbackFocus: bodyTextContainerRef }} // fallback to resolve unit test errors https://github.com/focus-trap/focus-trap-react/issues/91
|
|
57
58
|
onExit={onExit}
|
|
58
59
|
getApplicationNode={getApplicationNode}
|
|
59
60
|
titleText={modalHeaderText}
|
|
@@ -83,6 +84,7 @@ const Modal = ({
|
|
|
83
84
|
<Box background={modalBodyBg} padding="1.5rem">
|
|
84
85
|
<Stack childGap="1.5rem">
|
|
85
86
|
<Box
|
|
87
|
+
ref={bodyTextContainerRef}
|
|
86
88
|
borderWidthOverride={noBorder && "0 0 2px 0"}
|
|
87
89
|
borderColor={!noBorder && SILVER_GREY}
|
|
88
90
|
padding={!noBorder && "0 0 1.5rem 0"}
|
|
@@ -172,7 +174,6 @@ const Modal = ({
|
|
|
172
174
|
) : (
|
|
173
175
|
<Box padding="0.5rem">
|
|
174
176
|
<ButtonWithAction
|
|
175
|
-
ref={closeBtnRef}
|
|
176
177
|
action={hideModal}
|
|
177
178
|
variant="primary"
|
|
178
179
|
text={closeButtonText}
|