diff --git a/.Jules/palette.md b/.Jules/palette.md new file mode 100644 index 0000000..53c1cde --- /dev/null +++ b/.Jules/palette.md @@ -0,0 +1,5 @@ +# Palette's Journal - UX & Accessibility Learnings + +## 2026-02-21 - Search Bar 'Clear' Button UX +**Learning:** Search inputs in complex data lists significantly benefit from a persistent 'Clear' button that appears only when text is present. This reduces user friction during multi-step filtering workflows. Keyboard accessibility must be maintained by returning focus to the input after clearing and providing descriptive ARIA labels. +**Action:** Implement 'Clear' buttons using absolute positioning within the input container and ensure triggering an 'input' event (or manual DOM update) to refresh filtered lists immediately. diff --git a/app/templates/shared/list_base.html b/app/templates/shared/list_base.html index 0bcb254..568a938 100755 --- a/app/templates/shared/list_base.html +++ b/app/templates/shared/list_base.html @@ -8,13 +8,22 @@
-
- - +
+
@@ -76,14 +85,32 @@

// Basis-Suchfunktion document.addEventListener('DOMContentLoaded', function() { const searchInput = document.getElementById('searchInput'); + const clearSearch = document.getElementById('clearSearch'); + + function updateSearch(searchTerm) { + searchTerm = searchTerm.toLowerCase(); + document.querySelectorAll('.data-row').forEach(row => { + const searchableContent = row.textContent.toLowerCase(); + row.style.display = searchableContent.includes(searchTerm) ? '' : 'none'; + }); + + if (clearSearch) { + clearSearch.classList.toggle('hidden', searchTerm === ''); + } + } + if (searchInput) { searchInput.addEventListener('input', function(e) { - const searchTerm = e.target.value.toLowerCase(); - document.querySelectorAll('.data-row').forEach(row => { - const searchableContent = row.textContent.toLowerCase(); - row.style.display = searchableContent.includes(searchTerm) ? '' : 'none'; + updateSearch(e.target.value); + }); + + if (clearSearch) { + clearSearch.addEventListener('click', function() { + searchInput.value = ''; + updateSearch(''); + searchInput.focus(); }); - }); + } } // Sortier-Funktionalität