Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/runtime/client/partials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
39 changes: 39 additions & 0 deletions tests/partials_test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<Doc>
<div f-client-nav>
<dialog open>
<p>Greetings, one and all!</p>
<form method="dialog">
<Partial name="foo">
<p class="init">init</p>
</Partial>
<SelfCounter />
<button type="submit" class="update">OK</button>
</form>
</dialog>
</div>
</Doc>,
);
});

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 () => {
Expand Down