Skip to content

fix(web): flush Radix FocusScope timer before jsdom teardown in contacts table test - #196

Merged
stewartjarod merged 1 commit into
mainfrom
fix/contacts-table-test-focus-scope-flake
Oct 19, 2026
Merged

stewartjarod merged 1 commit into
mainfrom
fix/contacts-table-test-focus-scope-flake

Conversation

@stewartjarod

Copy link
Copy Markdown
Contributor

What

test-web failed on main at 15b8000 even though all 3,351 tests passed. Vitest caught one unhandled error from contacts-table-analytics.test.tsx:

TypeError: Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1 is not of type 'Event'.
  ❯ @radix-ui/react-focus-scope/dist/index.mjs:92 (Timeout._onTimeout)

Why

Radix FocusScope dispatches its unmount event from a setTimeout(0). The test's afterEach(cleanup) unmounts but doesn't wait for that timer. When the timer fires after vitest tears down jsdom, the event belongs to a dead realm and dispatchEvent rejects it.

Fix

After cleanup(), afterEach waits one macrotask so the timer fires while jsdom is still alive.

Verified locally: the file passes 3/3 runs.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Pzn7odPuYSivoc4b2XyQ7q

…cts table test

Radix FocusScope dispatches its unmount event from a setTimeout(0). When
that fired after vitest tore down jsdom, the cross-realm CustomEvent was
rejected by dispatchEvent and surfaced as an unhandled error, failing
test-web on main even though all tests passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pzn7odPuYSivoc4b2XyQ7q
@vercel

vercel Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
wraps-web Ready Ready Preview Oct 19, 2026 2:37pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
wraps-website Skipped Skipped Oct 19, 2026 2:37pm UTC

Request Review

@vercel
vercel Bot temporarily deployed to Preview – wraps-website October 19, 2026 14:35 Inactive
@stewartjarod
stewartjarod merged commit 2eb59f0 into main Oct 19, 2026
19 checks passed
@stewartjarod
stewartjarod deleted the fix/contacts-table-test-focus-scope-flake branch October 19, 2026 14:50

This branch was successfully deployed

1 active and 1 inactive deployments
Preview – wraps-web — 1d06511b Deployed Oct 19, 2026 by vercel[bot]
Preview – wraps-website — 1d06511b Deployed Oct 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant