1
0
Fork 0
mirror of https://github.com/codex-team/codex.docs.git synced 2025-08-07 14:35:26 +02:00

expand every match

This commit is contained in:
Umang G. Patel 2022-10-12 22:20:14 +05:30
parent 5b668f7fb0
commit 6be524d3aa

View file

@ -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({