@thecb/components 7.0.0-beta.3 → 7.0.0-beta.6

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.3",
3
+ "version": "7.0.0-beta.6",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -47,14 +47,15 @@ const Modal = ({
47
47
  children
48
48
  }) => {
49
49
  const { isMobile } = useContext(ThemeContext);
50
+ const closeBtnRef = useRef(null);
50
51
  const bodyTextContainerRef = useRef(null);
51
-
52
+ debugger;
52
53
  return (
53
54
  <Fragment>
54
55
  {modalOpen && (
55
56
  <AriaModal
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
+ initialFocus={closeBtnRef ?? bodyTextContainerRef ?? '#root'}
58
+ focusTrapOptions={{ delayInitialFocus: false, fallbackFocus: closeBtnRef ?? bodyTextContainerRef ?? '#root'}} // fallback to resolve unit test errors https://github.com/focus-trap/focus-trap-react/issues/91
58
59
  onExit={onExit}
59
60
  getApplicationNode={getApplicationNode}
60
61
  titleText={modalHeaderText}
@@ -174,6 +175,7 @@ const Modal = ({
174
175
  ) : (
175
176
  <Box padding="0.5rem">
176
177
  <ButtonWithAction
178
+ ref={closeBtnRef}
177
179
  action={hideModal}
178
180
  variant="primary"
179
181
  text={closeButtonText}