File tree Expand file tree Collapse file tree 3 files changed +33
-3
lines changed
packages/braid-design-system/src/lib/components/private/Modal Expand file tree Collapse file tree 3 files changed +33
-3
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' braid-design-system ' : patch
3
+ ---
4
+
5
+ ---
6
+ updated:
7
+ - Dialog
8
+ - Drawer
9
+ ---
10
+
11
+ ** Dialog, Drawer** : Ensure that only elements outside the ` Dialog ` or ` Drawer ` are ` aria-hidden ` when open
12
+
13
+ Fixes an issue where the close button inside the ` Dialog ` or ` Drawer ` was incorrectly inside an ` aria-hidden ` region.
Original file line number Diff line number Diff line change @@ -102,7 +102,6 @@ export const ModalContent = ({
102
102
...restProps
103
103
} : ModalContentProps ) => {
104
104
const resolvedId = useFallbackId ( id ) ;
105
-
106
105
const descriptionId = useId ( ) ;
107
106
108
107
const defaultModalRef = useRef < HTMLElement > ( null ) ;
@@ -140,6 +139,7 @@ export const ModalContent = ({
140
139
justifyContent = { justifyContent }
141
140
>
142
141
< Box
142
+ ref = { modalRef }
143
143
position = "relative"
144
144
display = "flex"
145
145
alignItems = "center"
@@ -153,10 +153,8 @@ export const ModalContent = ({
153
153
width = { width !== 'content' ? 'full' : undefined }
154
154
maxWidth = { width !== 'content' ? width : undefined }
155
155
>
156
- { /* modalRef gets forwarded down to child element by RemoveScroll by `forwardProps` */ }
157
156
< RemoveScroll
158
157
noRelative // Allows portalled elements to be positioned correctly relative to the viewport size
159
- ref = { modalRef }
160
158
forwardProps
161
159
enabled = { scrollLock }
162
160
>
Original file line number Diff line number Diff line change @@ -228,5 +228,24 @@ export const modalTestSuite = (
228
228
}
229
229
expect ( queryByRole ( 'dialog' ) ) . not . toBeInTheDocument ( ) ;
230
230
} ) ;
231
+
232
+ it ( 'should have a close button that is not aria-hidden' , async ( ) => {
233
+ const { getByTestId, queryByRole } = renderTestCase ( ) ;
234
+
235
+ const dialogOpenButton = getByTestId ( 'buttonBefore' ) ;
236
+ await userEvent . click ( dialogOpenButton ) ;
237
+
238
+ // Waiting for `ariaHideOthers` to apply
239
+ await waitFor ( ( ) =>
240
+ expect ( document . querySelector ( '[data-aria-hidden]' ) ) . not . toBeNull ( ) ,
241
+ ) ;
242
+
243
+ const closeButton = queryByRole ( 'button' , {
244
+ name : CLOSE_LABEL ,
245
+ hidden : false ,
246
+ } ) ;
247
+
248
+ expect ( closeButton ) . not . toBeNull ( ) ;
249
+ } ) ;
231
250
} ) ;
232
251
} ;
You can’t perform that action at this time.
0 commit comments