From 6be524d3aaec5187db1ce40c998472a7a933730f Mon Sep 17 00:00:00 2001 From: "Umang G. Patel" <23169768+robonetphy@users.noreply.github.com> Date: Wed, 12 Oct 2022 22:20:14 +0530 Subject: [PATCH] expand every match --- src/frontend/js/classes/sidebar-filter.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/frontend/js/classes/sidebar-filter.js b/src/frontend/js/classes/sidebar-filter.js index 436f5f0..c58e2fe 100644 --- a/src/frontend/js/classes/sidebar-filter.js +++ b/src/frontend/js/classes/sidebar-filter.js @@ -209,13 +209,6 @@ export default class SidebarFilter { element.classList.add(SidebarFilter.CSS.sectionTitleSelected); } else if (type === 'item') { element.classList.add(SidebarFilter.CSS.sectionListItemSlelected); - // close section. - const parentSection = element.closest('section'); - - // if item is in collapsed section, expand it. - if (!parentSection.classList.contains(SidebarFilter.CSS.sectionTitleActive)) { - this.setSectionCollapsed(parentSection, false); - } } // scroll to focused title or item. @@ -334,10 +327,16 @@ export default class SidebarFilter { }); } if (!isTitleMatch && !isSingleItemMatch) { - // hide section and it's items are not a match. + // hide section if it's items are not a match. section.classList.add(SidebarFilter.CSS.sectionHidden); } else { - // show section and it's items are a match. + const parentSection = sectionTitle.closest('section'); + + // if item is in collapsed section, expand it. + if (!parentSection.classList.contains(SidebarFilter.CSS.sectionTitleActive)) { + this.setSectionCollapsed(parentSection, false); + } + // show section if it's items are a match. section.classList.remove(SidebarFilter.CSS.sectionHidden); // add section title to search results. this.searchResults.push({