diff options
| author | Adam Malczewski <[email protected]> | 2026-10-24 17:09:17 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-10-24 17:09:17 +0900 |
| commit | 0ba54b4455cb560cf7a82baf71b31ed129cfc29b (patch) | |
| tree | 424ac806b3822247c0b835ee38ffabdf87f5016e /vitest-setup.ts | |
| parent | 83442d00d9d9c7f0ca200d6a2e8b42195708493f (diff) | |
| download | dispatch-web-0ba54b4455cb560cf7a82baf71b31ed129cfc29b.tar.gz dispatch-web-0ba54b4455cb560cf7a82baf71b31ed129cfc29b.zip | |
fix(tabs): finish accessible cascade confirmation and verify active closes
Diffstat (limited to 'vitest-setup.ts')
| -rw-r--r-- | vitest-setup.ts | 12 |
1 files changed, 12 insertions, 0 deletions
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<HTMLElement>("button")?.focus(); + }; + HTMLDialogElement.prototype.close = function () { + this.open = false; + }; +} |
