diff --git a/packages/webawesome/docs/assets/scripts/search-list.js b/packages/webawesome/docs/assets/scripts/search-list.js index 25c999046..c4200834f 100644 --- a/packages/webawesome/docs/assets/scripts/search-list.js +++ b/packages/webawesome/docs/assets/scripts/search-list.js @@ -5,7 +5,7 @@ *
* * - *

Category Name

+ *

Category Name

*
* * Component Title @@ -33,6 +33,7 @@ function enableSearchLists() { const query = e.target.value.toLowerCase().trim(); let totalVisible = 0; + // Handle sections with headings container.querySelectorAll('h1, h2, h3, h4, h5, h6').forEach(heading => { const section = heading.nextElementSibling; if (!section) return; @@ -51,6 +52,21 @@ function enableSearchLists() { totalVisible += sectionVisible; }); + // Handle standalone sections without headings + container.querySelectorAll('.search-list-grid').forEach(section => { + const prevElement = section.previousElementSibling; + const hasHeading = prevElement && /^H[1-6]$/.test(prevElement.tagName); + + if (!hasHeading) { + section.querySelectorAll('a').forEach(card => { + const title = card.querySelector('.page-name')?.textContent?.toLowerCase() || ''; + const visible = !query || title.includes(query); + card.style.display = visible ? '' : 'none'; + if (visible) totalVisible++; + }); + } + }); + emptyState.hidden = totalVisible > 0; }, 300); });