diff --git a/assets/vendor/search_combobox.js b/assets/vendor/search_combobox.js index a4bffc2..0b80340 100644 --- a/assets/vendor/search_combobox.js +++ b/assets/vendor/search_combobox.js @@ -24,6 +24,9 @@ const SearchCombobox = { const wasSearching = this.searchTerm && this.searchTerm.length > 0; const preservedSearchTerm = this.searchTerm || ''; + // IMPORTANT: Check if search input was focused before update + const searchInputWasFocused = this.searchInput && document.activeElement === this.searchInput; + const wasDropdownShouldBeOpen = this.dropdownShouldBeOpen; this.init(); @@ -45,6 +48,15 @@ const SearchCombobox = { // Delay initialization to ensure LiveView updates are complete setTimeout(() => { this.initializeSelection(); + + // IMPORTANT: Restore focus to search input if it was focused before update + // This prevents focus loss during debounced search, especially important on mobile + if (searchInputWasFocused && this.searchInput && (wasOpen || wasSearching)) { + this.searchInput.focus(); + // Set cursor position to end of input for better UX + const length = this.searchInput.value.length; + this.searchInput.setSelectionRange(length, length); + } }, 0); if (wasOpen || wasSearching) { diff --git a/lib/geo_web/components/layouts/app.html.heex b/lib/geo_web/components/layouts/app.html.heex index c7fd577..6d4a4d1 100644 --- a/lib/geo_web/components/layouts/app.html.heex +++ b/lib/geo_web/components/layouts/app.html.heex @@ -1,62 +1,72 @@
-
-
- - - -

- v{Application.spec(:phoenix, :vsn)} | v{Application.spec(:geo, :vsn)} -

- - GitHub - + +
+ +
+
+ + Phoenix Framework + +

+ v{Application.spec(:phoenix, :vsn)} | v{Application.spec(:geo, :vsn)} +

+
+
+ + GitHub + + +
+
+ + + -
-
+
<.flash_group flash={@flash} /> {@inner_content}
diff --git a/lib/geo_web/components/layouts/root.html.heex b/lib/geo_web/components/layouts/root.html.heex index ab73f41..c836411 100644 --- a/lib/geo_web/components/layouts/root.html.heex +++ b/lib/geo_web/components/layouts/root.html.heex @@ -6,8 +6,8 @@ - <.live_title default="Geo" suffix=" ยท Phoenix Framework"> - {assigns[:page_title]} + <.live_title default="Geo"> + {assigns[:page_title] || "Geo"}