mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
fix(ux): Prevent <Enter> from submitting filters forms (#5213)
Fixes #5211
This commit is contained in:
@@ -97,6 +97,7 @@ defmodule Web.LiveTable do
|
||||
for={@form}
|
||||
phx-change="filter"
|
||||
phx-debounce="100"
|
||||
onkeydown="return event.key != 'Enter';"
|
||||
>
|
||||
<.input type="hidden" name="table_id" value={@live_table_id} />
|
||||
|
||||
|
||||
@@ -52,6 +52,20 @@ defmodule Web.Live.Groups.IndexTest do
|
||||
assert Floki.text(button) =~ "Add Group"
|
||||
end
|
||||
|
||||
test "filters form has onkeydown attribute to prevent Enter from submitting form", %{
|
||||
account: account,
|
||||
identity: identity,
|
||||
conn: conn
|
||||
} do
|
||||
{:ok, _lv, html} =
|
||||
conn
|
||||
|> authorize_conn(identity)
|
||||
|> live(~p"/#{account}/groups")
|
||||
|
||||
assert form = Floki.find(html, "form#groups-filters")
|
||||
assert ["return event.key != 'Enter';"] = Floki.attribute(form, "onkeydown")
|
||||
end
|
||||
|
||||
test "renders empty table when there are no groups", %{
|
||||
account: account,
|
||||
identity: identity,
|
||||
|
||||
Reference in New Issue
Block a user