Skip to content

Commit

Permalink
fix: do not submit <ActionForm> on formmethod="dialog" submission (
Browse files Browse the repository at this point in the history
…closes #2523)
  • Loading branch information
gbj committed Apr 15, 2024
1 parent 9a51fb1 commit fe06c6b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions router/src/components/form.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,17 @@ where
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();

match ServFn::from_event(&ev) {
Expand Down

0 comments on commit fe06c6b

Please sign in to comment.