Merge pull request #729 from dajiaohuang/fix-search-clear-restore

fix: restore the section view when the search box is cleared
This commit is contained in:
Aljaz
2026-10-03 08:37:42 +02:00
committed by GitHub
+3 -1
View File
@@ -496,7 +496,9 @@ searchInput.addEventListener('input', (e) => {
if (!searchTerm) { if (!searchTerm) {
// If search is empty, restore current category view // If search is empty, restore current category view
const currentCategory = document.querySelector('.nav-links a.active')?.textContent; // (the nav link's textContent carries the icon markup's whitespace,
// so it must be trimmed to match the keys in window.parsedResources)
const currentCategory = document.querySelector('.nav-links a.active')?.textContent.trim();
if (currentCategory) { if (currentCategory) {
displaySection(currentCategory, window.parsedResources); displaySection(currentCategory, window.parsedResources);
} }