Skip to content

Commit

Permalink
Merge pull request #101 from DamascenoV/dialog_fix
Browse files Browse the repository at this point in the history
Dialog on_cancel
  • Loading branch information
bluzky authored Dec 7, 2024
2 parents 28670e7 + ffa40d3 commit 1835874
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/salad_ui/dialog.ex
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ defmodule SaladUI.Dialog do
phx-remove={JS.exec("phx-hide-modal", to: "##{@id}")}
phx-show-modal={show_modal(@id)}
phx-hide-modal={hide_modal(@id)}
data-cancel={JS.exec(@on_cancel, "phx-remove")}
class="relative z-50 hidden group/dialog"
>
<div
Expand All @@ -66,9 +67,9 @@ defmodule SaladUI.Dialog do
>
<.focus_wrap
id={"#{@id}-wrap"}
phx-window-keydown={JS.exec("phx-hide-modal", to: "##{@id}")}
phx-window-keydown={JS.exec("data-cancel", to: "##{@id}")}
phx-key="escape"
phx-click-away={JS.exec("phx-hide-modal", to: "##{@id}")}
phx-click-away={JS.exec("data-cancel", to: "##{@id}")}
class="w-full sm:max-w-[425px]"
>
<div
Expand Down

0 comments on commit 1835874

Please sign in to comment.