From ea69ab6e7cfc6295d5dfecb6a0beaabdd2e4e74f Mon Sep 17 00:00:00 2001
From: jensilo <k@jensheise.com>
Date: Sun, 24 Dec 2023 17:31:07 +0100
Subject: [PATCH] fix search input focus for chromium browsers
---
public/assets/js/eiffel.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/public/assets/js/eiffel.js b/public/assets/js/eiffel.js
index 318d2ff..a84c496 100644
--- a/public/assets/js/eiffel.js
+++ b/public/assets/js/eiffel.js
@@ -29,7 +29,9 @@ registerCopyToClipboard();
function registerFocuses() {
// focus search input when search form is loaded (in the case bootstrap finishes showing the modal before the form is loaded)
document.addEventListener('htmx:afterSettle', function(event) {
- if (event.detail.elt.id !== 'eiffelTemplateSearch') return;
+ // focus search input if the search modal was loaded or the search results were loaded
+ // unfortunately, chromium takes the focus from the input when the results are loaded, so we need to refocus
+ if (event.detail.elt.id !== 'eiffelTemplateSearch' && event.detail.elt.id !== 'eiffelTemplateSearchResults') return;
focusSearchInput();
})
--
GitLab