Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Fix shifting focus to filter bar when typing / in a legit input (#5583)

Adam Rutkowskie7e553cf9d27
diff --git a/lib/plausible_web/components/generic.ex b/lib/plausible_web/components/generic.ex
index d34c6ba8a1..a8f796f9c2 100644
--- a/lib/plausible_web/components/generic.ex
+++ b/lib/plausible_web/components/generic.ex
@@ -878,7 +878,7 @@ defmodule PlausibleWeb.Components.Generic do
x-ref="filter_text"
phx-debounce={200}
autocomoplete="off"
- x-on:keydown.prevent.slash.window="$refs.filter_text.focus(); $refs.filter_text.select();"
+ x-on:keydown.slash.window="if (['INPUT', 'TEXTAREA', 'SELECT'].includes(document.activeElement.tagName) || document.activeElement.isContentEditable) return; $refs.filter_text.focus(); $refs.filter_text.select();"
x-on:keydown.escape="$refs.filter_text.blur(); $refs.reset_filter?.dispatchEvent(new Event('click', {bubbles: true, cancelable: true}));"
value={@filter_text}
x-on:focus={"$refs.filter_text.placeholder = '#{@placeholder}';"}