Skip to content

Commit

Permalink
Merge pull request #79 from naymspace/feature/fix-has-many-through
Browse files Browse the repository at this point in the history
Render modal even if its not open
  • Loading branch information
Flo0807 authored Jan 31, 2024
2 parents eaddb5d + aa9a8a0 commit 82f0756
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/backpex/html/layout.ex
Original file line number Diff line number Diff line change
Expand Up @@ -440,10 +440,13 @@ defmodule Backpex.HTML.Layout do
|> assign(:classes, get_modal_classes(assigns))

~H"""
<div :if={@open} id="modal">
<div id="modal">
<div
id="modal-overlay"
class="animate-fade-in fixed inset-0 z-50 bg-gray-900 bg-opacity-30 transition-opacity"
class={[
"animate-fade-in fixed inset-0 z-50 bg-gray-900 bg-opacity-30 transition-opacity",
unless(@open, do: "hidden")
]}
aria-hidden="true"
>
</div>
Expand All @@ -458,9 +461,9 @@ defmodule Backpex.HTML.Layout do
>
<div
class={@classes}
phx-click-away={hide_modal(@target, @close_event_name)}
phx-window-keydown={hide_modal(@target, @close_event_name)}
phx-key="escape"
phx-click-away={@open && hide_modal(@target, @close_event_name)}
phx-window-keydown={@open && hide_modal(@target, @close_event_name)}
phx-key={@open && "escape"}
>
<!-- Header -->
<div class="border-b border-gray-100 px-5 py-3">
Expand Down

0 comments on commit 82f0756

Please sign in to comment.