Fix language-search fragment

- mots-clé and language where sharing the same q variable for the input value; they now have unique variables.

The admin language-search-fragment was missing App::boot() which the tag-search
fragment had. This caused the language suggestion dropdown to not return results
in Firefox. Both fragments now follow the same bootstrap pattern.

Rewrote language-search-fragment.php to use the same clean pattern as
tag-search-fragment.php: ->searchLanguages(), simple exact match check,
no predefined exclusion list. Both fragments now share identical structure.

fix: exclude main languages (français, anglais, néerlandais) from language-search suggestions
This commit is contained in:
Pontoporeia
2026-05-10 13:20:40 +02:00
parent a3ded16915
commit 6224e3ede0
6 changed files with 53 additions and 65 deletions

View File

@@ -62,7 +62,7 @@ $langCount = count($selectedLanguages);
<!-- Search input (hidden when max languages reached) -->
<div class="tag-search-input-wrap"<?= $langCount >= $maxLanguages ? ' style="display:none"' : '' ?>>
<input type="text"
name="q"
name="language_search_q"
id="<?= htmlspecialchars($id) ?>-search"
class="tag-search-input"
placeholder="<?= htmlspecialchars($placeholder) ?>"
@@ -188,8 +188,10 @@ $langCount = count($selectedLanguages);
// Click on suggestion
dropdown.addEventListener('click', function(e) {
console.log('[lang-search] dropdown click, target:', e.target.tagName, e.target.className);
const btn = e.target.closest('.tag-search-item');
if (!btn) return;
if (!btn) { console.log('[lang-search] no .tag-search-item found in click path'); return; }
console.log('[lang-search] found btn:', btn.getAttribute('data-tag-name'), btn.className);
selectLang(btn);
});
@@ -224,12 +226,21 @@ $langCount = count($selectedLanguages);
search.addEventListener('blur', function() {
setTimeout(function() {
if (!dropdown.contains(document.activeElement)) {
console.log('[lang-search] blur: hiding dropdown');
dropdown.innerHTML = '';
selectedIdx = -1;
}
}, 150);
});
// Log HTMX responses
document.body.addEventListener('htmx:afterSwap', function(e) {
if (e.detail.target && e.detail.target.id === '<?= htmlspecialchars($id) ?>-suggestions') {
console.log('[lang-search] htmx:afterSwap, target:', e.detail.target.id, 'html length:', e.detail.target.innerHTML.length);
console.log('[lang-search] innerHTML:', e.detail.target.innerHTML);
}
});
function htmlEscape(str) {
const el = document.createElement('span');
el.textContent = str;

View File

@@ -60,7 +60,7 @@ $tagCount = count($selectedTags);
<!-- Search input (hidden when max tags reached) -->
<div class="tag-search-input-wrap"<?= $tagCount >= $maxTags ? ' style="display:none"' : '' ?>>
<input type="text"
name="q"
name="tag_search_q"
id="<?= htmlspecialchars($id) ?>-search"
class="tag-search-input"
placeholder="<?= htmlspecialchars($placeholder) ?>"