fix(badges): focus search input when Search is triggered with too-short query

Pressing the Search button or Enter with fewer than the required min chars
now focuses the input field instead of silently doing nothing, so the user
gets clear feedback about where to type.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott Idem
2026-06-02 16:55:38 -04:00
parent 9e361eae9b
commit 99b8eb0b5e

View File

@@ -56,7 +56,10 @@ let effective_min_chars = $derived.by(() => {
function handle_search_trigger() { function handle_search_trigger() {
const qry = (badges_loc.current.fulltext_search_qry_str ?? '').trim(); const qry = (badges_loc.current.fulltext_search_qry_str ?? '').trim();
if (qry.length < effective_min_chars) return; if (qry.length < effective_min_chars) {
document.getElementById('badge_fulltext_search_qry_str')?.focus();
return;
}
badges_loc.current.search_version++; badges_loc.current.search_version++;
} }