From f9d3d4a34ee1748e780972f5928e3e12def11a3d Mon Sep 17 00:00:00 2001 From: Nicholas Petrasek Date: Wed, 9 Sep 2026 11:49:55 +0200 Subject: [PATCH] test: wait for source inspector keyboard readiness --- website/components/source-code/SourceInspector.test.tsx | 6 ++++++ 1 file changed, 6 insertions(+) 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 } }