From 88af2463dbf0c92fd84a0d498f63d0b477301ede Mon Sep 17 00:00:00 2001 From: Dzung Nguyen Date: Mon, 10 Feb 2025 21:56:41 +0700 Subject: [PATCH] Fix phoenix doesn't trigger form change event --- lib/salad_ui/switch.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/salad_ui/switch.ex b/lib/salad_ui/switch.ex index e5a32a4..53f7767 100644 --- a/lib/salad_ui/switch.ex +++ b/lib/salad_ui/switch.ex @@ -50,6 +50,6 @@ defmodule SaladUI.Switch do defp toggle(id) do %JS{} |> JS.toggle_attribute({"data-state", "checked", "unchecked"}) - |> JS.toggle_attribute({"checked", true}, to: "##{id} input[type=checkbox]") + |> JS.dispatch("click", to: "##{id} input[type=checkbox]", bubbles: false) end end