mirror of
https://github.com/aljazceru/awesome-nostr.git
synced 2026-10-05 11:28:22 +00:00
fix: restore the section view when the search box is cleared
The nav link's textContent includes the whitespace around the chevron icon, so it never matched the trimmed section keys in window.parsedResources. displaySection() cleared the container and then threw, leaving the page with only a section heading and no resources. Trim the value so clearing the search restores the active section.
This commit is contained in:
@@ -496,7 +496,9 @@ searchInput.addEventListener('input', (e) => {
|
||||
|
||||
if (!searchTerm) {
|
||||
// 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) {
|
||||
displaySection(currentCategory, window.parsedResources);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user