@thecb/components 10.5.0-beta.2 → 10.5.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
|
@@ -56,16 +56,17 @@ const Modal = ({
|
|
|
56
56
|
// the `fallbackFocus` option. However, React does not guarantee the ref supplied to
|
|
57
57
|
// this option will be populated on initial render when `focus-trap` is checking
|
|
58
58
|
// these option. When there are no buttons in the modal, this causes an error.
|
|
59
|
-
// Because `focus-trap` cannot be disabled, the ref requires a
|
|
60
|
-
// `focus-trap` until React populates it with the real ref value.
|
|
59
|
+
// Because `focus-trap` cannot be disabled, the ref itself requires a default value
|
|
60
|
+
// to satisfy `focus-trap` until React populates it with the real ref value.
|
|
61
61
|
//
|
|
62
62
|
// See:
|
|
63
63
|
// - https://react.dev/reference/react/useRef#caveats
|
|
64
64
|
// - https://github.com/davidtheclark/react-aria-modal/pull/103
|
|
65
|
-
|
|
65
|
+
// - https://github.com/focus-trap/focus-trap?tab=readme-ov-file#createoptions
|
|
66
|
+
const modalContainerRef = useRef("[id='react-aria-modal-dialog']");
|
|
66
67
|
|
|
67
68
|
return (
|
|
68
|
-
<div ref={modalContainerRef} data-qa={dataQa}>
|
|
69
|
+
<div ref={modalContainerRef} tabIndex="-1" data-qa={dataQa}>
|
|
69
70
|
{modalOpen && (
|
|
70
71
|
<AriaModal
|
|
71
72
|
focusTrapOptions={{
|
|
@@ -70,13 +70,14 @@ const Modal = ({
|
|
|
70
70
|
// the `fallbackFocus` option. However, React does not guarantee the ref supplied to
|
|
71
71
|
// this option will be populated on initial render when `focus-trap` is checking
|
|
72
72
|
// these option. When there are no buttons in the modal, this causes an error.
|
|
73
|
-
// Because `focus-trap` cannot be disabled, the ref requires a
|
|
74
|
-
// `focus-trap` until React populates it with the real ref value.
|
|
73
|
+
// Because `focus-trap` cannot be disabled, the ref itself requires a default value
|
|
74
|
+
// to satisfy `focus-trap` until React populates it with the real ref value.
|
|
75
75
|
//
|
|
76
76
|
// See:
|
|
77
77
|
// - https://react.dev/reference/react/useRef#caveats
|
|
78
78
|
// - https://github.com/davidtheclark/react-aria-modal/pull/103
|
|
79
|
-
|
|
79
|
+
// - https://github.com/focus-trap/focus-trap?tab=readme-ov-file#createoptions
|
|
80
|
+
const modalContainerRef = useRef("[id='react-aria-modal-dialog']");
|
|
80
81
|
|
|
81
82
|
const hasCloseButton = onlyCloseButton && !noButtons;
|
|
82
83
|
const hasCancelButton = !onlyContinueButton && !onlyCloseButton && !noButtons;
|
|
@@ -155,6 +156,7 @@ const Modal = ({
|
|
|
155
156
|
cancelButtonText={cancelButtonText}
|
|
156
157
|
hideModal={hideModal}
|
|
157
158
|
isMobile={isMobile}
|
|
159
|
+
key="cancel"
|
|
158
160
|
/>
|
|
159
161
|
),
|
|
160
162
|
hasContinueButton && (
|
|
@@ -166,6 +168,7 @@ const Modal = ({
|
|
|
166
168
|
isContinueActionDisabled={isContinueActionDisabled}
|
|
167
169
|
isLoading={isLoading}
|
|
168
170
|
isMobile={isMobile}
|
|
171
|
+
key="continue"
|
|
169
172
|
useDangerButton={useDangerButton}
|
|
170
173
|
/>
|
|
171
174
|
),
|
|
@@ -175,6 +178,7 @@ const Modal = ({
|
|
|
175
178
|
closeButtonText={closeButtonText}
|
|
176
179
|
hideModal={hideModal}
|
|
177
180
|
isMobile={isMobile}
|
|
181
|
+
key="close"
|
|
178
182
|
/>
|
|
179
183
|
)
|
|
180
184
|
].filter(button => button)}
|