+
@@ -192,17 +194,15 @@ defmodule LivebookWeb.CoreComponents do
aria-modal="true"
tabindex="0"
autofocus
- phx-window-keydown={hide_modal(@id)}
- phx-click-away={hide_modal(@id)}
+ phx-window-keydown={JS.exec("data-cancel", to: "##{@id}")}
+ phx-click-away={JS.exec("data-cancel", to: "##{@id}")}
phx-key="escape"
>
- <.link :if={@patch} patch={@patch} class="hidden" id={"#{@id}-return"}>
- <.link :if={@navigate} patch={@navigate} class="hidden" id={"#{@id}-return"}>
- <.modal show={@show_key} id="show-key-modal" width={:medium} patch={~p"/hub/#{@hub.id}"}>
+ <.modal :if={@show_key} id="key-modal" show width={:medium} patch={~p"/hub/#{@hub.id}"}>
<.teams_key_modal teams_key={@hub.teams_key} />
diff --git a/test/livebook_teams/web/hub/new_live_test.exs b/test/livebook_teams/web/hub/new_live_test.exs
index f8759852c..fcbf9e546 100644
--- a/test/livebook_teams/web/hub/new_live_test.exs
+++ b/test/livebook_teams/web/hub/new_live_test.exs
@@ -52,11 +52,11 @@ defmodule LivebookWeb.Hub.NewLiveTest do
# access the page and shows the teams key modal
{:ok, view, _html} = live(conn, "/hub/team-#{name}?show-key=true")
- refute has_element?(view, "#show-key-modal.hidden")
+ assert has_element?(view, "#key-modal")
# access the page when closes the modal
assert {:ok, view, _html} = live(conn, "/hub/team-#{name}")
- assert has_element?(view, "#show-key-modal.hidden")
+ refute has_element?(view, "#key-modal")
# checks if the hub is in the sidebar
assert_sidebar_hub(view, "team-#{name}", name)
@@ -113,11 +113,11 @@ defmodule LivebookWeb.Hub.NewLiveTest do
# access the page and shows the teams key modal
{:ok, view, _html} = live(conn, "/hub/team-#{name}?show-key=true")
- refute has_element?(view, "#show-key-modal.hidden")
+ assert has_element?(view, "#key-modal")
# access the page when closes the modal
assert {:ok, view, _html} = live(conn, "/hub/team-#{name}")
- assert has_element?(view, "#show-key-modal.hidden")
+ refute has_element?(view, "#key-modal")
# checks if the hub is in the sidebar
assert_sidebar_hub(view, "team-#{name}", name)