diff --git a/website/components/source-code/SourceInspector.test.tsx b/website/components/source-code/SourceInspector.test.tsx index 882e7c92..8ec702a8 100644 --- a/website/components/source-code/SourceInspector.test.tsx +++ b/website/components/source-code/SourceInspector.test.tsx @@ -19,6 +19,12 @@ async function openInspector() { name: 'BasicSheet.tsx source', }) + // The dialog can render before its effect attaches keyboard handlers. + // Focus is moved by that same effect, so wait for the modal to be ready. + await waitFor(() => + expect(screen.getByRole('button', { name: 'Close source' })).toHaveFocus(), + ) + return { dialog, trigger } }