File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
src/components/overlays/Dialog Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -154,7 +154,7 @@ export const Dialog = forwardRef(function Dialog(
154154 }
155155
156156 return (
157- < FocusScope contain restoreFocus >
157+ < FocusScope contain restoreFocus autoFocus >
158158 { content }
159159 </ FocusScope >
160160 ) ;
@@ -250,6 +250,7 @@ const DialogContent = forwardRef(function DialogContent(
250250 styles = { styles }
251251 as = "section"
252252 { ...dialogProps }
253+ tabIndex = { undefined }
253254 mods = { { dismissable : isDismissable } }
254255 style = { { '--dialog-size' : `${ sizePxMap [ size ] || 288 } px` } }
255256 data-type = { type }
@@ -262,6 +263,7 @@ const DialogContent = forwardRef(function DialogContent(
262263 < Button
263264 qa = "ModalCloseButton"
264265 type = "neutral"
266+ tabIndex = "-1"
265267 styles = { CLOSE_BUTTON_STYLES }
266268 icon = { closeIcon || < CloseIcon /> }
267269 label = { formatMessage ( 'dismiss' ) }
Original file line number Diff line number Diff line change @@ -198,21 +198,20 @@ CloseOnEsc.play = async (context) => {
198198
199199 await userEvent . click ( trigger ) ;
200200
201+ await timeout ( 500 ) ;
202+
201203 const dialog = await findByRole ( 'dialog' ) ;
202204
203205 await expect ( dialog ) . toBeInTheDocument ( ) ;
204206 await expect ( dialog . contains ( document . activeElement ) ) . toBe ( true ) ;
205207
206- await timeout ( 500 ) ;
207-
208208 await userEvent . keyboard ( '{Escape}' ) ;
209209
210210 await timeout ( 500 ) ;
211211
212212 await expect ( dialog ) . not . toBeInTheDocument ( ) ;
213213
214- // @TODO : fix this
215- // await waitFor(() => expect(document.activeElement).toBe(trigger));
214+ await waitFor ( ( ) => expect ( document . activeElement ) . toBe ( trigger ) ) ;
216215} ;
217216
218217export const CloseOnEscCloseBehaviorHide : typeof Template = Template . bind ( { } ) ;
You can’t perform that action at this time.
0 commit comments