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

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.6",
3
+ "version": "7.0.0-beta.9",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -47,15 +47,14 @@ const Modal = ({
47
47
  children
48
48
  }) => {
49
49
  const { isMobile } = useContext(ThemeContext);
50
- const closeBtnRef = useRef(null);
51
- const bodyTextContainerRef = useRef(null);
52
- debugger;
50
+ const modalContainerRef = useRef(null);
53
51
  return (
54
- <Fragment>
52
+ <div ref={modalContainerRef}>
55
53
  {modalOpen && (
56
54
  <AriaModal
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
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
+ initialFocus={modalContainerRef?.current}
57
+ focusTrapOptions={{ delayInitialFocus: false, fallbackFocus: modalContainerRef?.current }}
59
58
  onExit={onExit}
60
59
  getApplicationNode={getApplicationNode}
61
60
  titleText={modalHeaderText}
@@ -85,7 +84,6 @@ const Modal = ({
85
84
  <Box background={modalBodyBg} padding="1.5rem">
86
85
  <Stack childGap="1.5rem">
87
86
  <Box
88
- ref={bodyTextContainerRef}
89
87
  borderWidthOverride={noBorder && "0 0 2px 0"}
90
88
  borderColor={!noBorder && SILVER_GREY}
91
89
  padding={!noBorder && "0 0 1.5rem 0"}
@@ -175,7 +173,6 @@ const Modal = ({
175
173
  ) : (
176
174
  <Box padding="0.5rem">
177
175
  <ButtonWithAction
178
- ref={closeBtnRef}
179
176
  action={hideModal}
180
177
  variant="primary"
181
178
  text={closeButtonText}
@@ -195,7 +192,7 @@ const Modal = ({
195
192
  </AriaModal>
196
193
  )}
197
194
  {children}
198
- </Fragment>
195
+ </div>
199
196
  );
200
197
  };
201
198