fix: do not submit `<ActionForm>` on `formmethod="dialog"` submission (closes #2523)

This commit is contained in:
Greg Johnston 2024-04-15 16:49:02 -04:00
parent 9a51fb17fc
commit fe06c6b91b
1 changed files with 11 additions and 0 deletions

View File

@ -488,6 +488,17 @@ where
return; return;
} }
// <button formmethod="dialog"> should *not* dispatch the action, but should be allowed to
// just bubble up and close the <dialog> naturally
let is_dialog = ev
.submitter()
.and_then(|el| el.get_attribute("formmethod"))
.as_deref()
== Some("dialog");
if is_dialog {
return;
}
ev.prevent_default(); ev.prevent_default();
match ServFn::from_event(&ev) { match ServFn::from_event(&ev) {