Skip to content

Commit

Permalink
Merge pull request #2531 from leptos-rs/2523
Browse files Browse the repository at this point in the history
fix: do not submit `<ActionForm>` on `formmethod="dialog"` submission (closes #2523)
  • Loading branch information
gbj authored Apr 15, 2024
2 parents 9a51fb1 + 03a56f8 commit 6141e73
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-semver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
test:
needs: [get-leptos-changed]
if: needs.get-leptos-changed.outputs.leptos_changed == 'true'
name: Run semver check (nightly-2024-03-31)
name: Run semver check (nightly-2024-04-14)
runs-on: ubuntu-latest

steps:
Expand All @@ -25,4 +25,4 @@ jobs:
- name: Semver Checks
uses: obi1kenobi/cargo-semver-checks-action@v2
with:
rust-toolchain: nightly-2024-03-31
rust-toolchain: nightly-2024-04-14
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ jobs:
with:
directory: ${{ matrix.directory }}
cargo_make_task: "ci"
toolchain: nightly-2024-03-31
toolchain: nightly-2024-04-14
4 changes: 2 additions & 2 deletions leptos_macro/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ dependencies = [
[tasks.test-leptos_macro-example]
description = "Tests the leptos_macro/example to check if macro handles doc comments correctly"
command = "cargo"
args = ["+nightly-2024-03-31", "test", "--doc"]
args = ["+nightly-2024-04-14", "test", "--doc"]
cwd = "example"
install_crate = false

[tasks.doc-leptos_macro-example]
description = "Docs the leptos_macro/example to check if macro handles doc comments correctly"
command = "cargo"
args = ["+nightly-2024-03-31", "doc"]
args = ["+nightly-2024-04-14", "doc"]
cwd = "example"
install_crate = false
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 6141e73

Please sign in to comment.