diff --git a/src/runtime/client/partials.ts b/src/runtime/client/partials.ts index 41a2c1e92ed..febffaef21a 100644 --- a/src/runtime/client/partials.ts +++ b/src/runtime/client/partials.ts @@ -219,10 +219,7 @@ document.addEventListener("submit", async (e) => { const lowerMethod = e.submitter?.getAttribute("formmethod")?.toLowerCase() ?? el.method.toLowerCase(); - if ( - lowerMethod !== "get" && lowerMethod !== "post" && - lowerMethod !== "dialog" - ) { + if (lowerMethod !== "get" && lowerMethod !== "post") { return; } diff --git a/tests/partials_test.tsx b/tests/partials_test.tsx index ae6815af773..fe97222b671 100644 --- a/tests/partials_test.tsx +++ b/tests/partials_test.tsx @@ -1833,6 +1833,45 @@ Deno.test({ }, }); +Deno.test({ + name: "partials - submit form dialog should do nothing", + fn: async () => { + const app = testApp() + .post("/partial", () => { + throw new Error("FAIL"); + }) + .get("/", (ctx) => { + return ctx.render( + +
+ +

Greetings, one and all!

+
+ +

init

+
+ + + +
+
+
, + ); + }); + + await withBrowserApp(app, async (page, address) => { + await page.goto(address, { waitUntil: "load" }); + await page.locator(".ready").wait(); + + await page.locator(".increment").click(); + await waitForText(page, ".output", "1"); + + await page.locator(".update").click(); + await page.locator("dialog:not([open])").wait(); + }); + }, +}); + Deno.test({ name: "partials - submit form redirect", fn: async () => {