From 0ba54b4455cb560cf7a82baf71b31ed129cfc29b Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Sat, 24 Oct 2026 17:09:17 +0900 Subject: fix(tabs): finish accessible cascade confirmation and verify active closes --- vitest-setup.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'vitest-setup.ts') diff --git a/vitest-setup.ts b/vitest-setup.ts index a0ace27..94aa5e8 100644 --- a/vitest-setup.ts +++ b/vitest-setup.ts @@ -42,3 +42,15 @@ if (typeof globalThis.PointerEvent === "undefined") { } globalThis.PointerEvent = PointerEventPolyfill as unknown as typeof PointerEvent; } + +// jsdom has no native modal dialog lifecycle. Fake only this browser edge; +// real-browser checks cover top-layer rendering and native focus containment. +if (typeof HTMLDialogElement !== "undefined" && !HTMLDialogElement.prototype.showModal) { + HTMLDialogElement.prototype.showModal = function () { + this.open = true; + this.querySelector("button")?.focus(); + }; + HTMLDialogElement.prototype.close = function () { + this.open = false; + }; +} -- cgit v1.2.3