@thecb/components 7.0.0-beta.0 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "7.0.0-beta.0",
3
+ "version": "7.0.0-beta.3",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -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,14 @@ const Modal = ({
47
47
  children
48
48
  }) => {
49
49
  const { isMobile } = useContext(ThemeContext);
50
+ const bodyTextContainerRef = useRef(null);
51
+
50
52
  return (
51
53
  <Fragment>
52
54
  {modalOpen && (
53
55
  <AriaModal
54
- focusDialog={true}
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
55
58
  onExit={onExit}
56
59
  getApplicationNode={getApplicationNode}
57
60
  titleText={modalHeaderText}
@@ -81,6 +84,7 @@ const Modal = ({
81
84
  <Box background={modalBodyBg} padding="1.5rem">
82
85
  <Stack childGap="1.5rem">
83
86
  <Box
87
+ ref={bodyTextContainerRef}
84
88
  borderWidthOverride={noBorder && "0 0 2px 0"}
85
89
  borderColor={!noBorder && SILVER_GREY}
86
90
  padding={!noBorder && "0 0 1.5rem 0"}