Skip to content

Commit

Permalink
Fix issue with index sometimes appearing empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit0 committed Jan 12, 2024
1 parent 5b93bb6 commit af0d1b4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
## Bug Fixes

- Fixed an issue where a namespace would not be created for merged function-namespaces which are declared as variables, #2478.
- Fixed an issue where, if the index section was collapsed when loading the page, all content within it would be hidden until expanded, and a member visibility checkbox was changed.

## v0.25.7 (2024-01-08)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class Filter extends Component {
this.setLocalStorage(this.fromLocalStorage());

style.innerHTML += `html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; }\n`;
this.handleValueChange();
this.updateIndexHeadingVisibility();
}

/**
Expand Down Expand Up @@ -60,6 +60,16 @@ export class Filter extends Component {
document.documentElement.classList.toggle(this.key, this.value);

this.app.filterChanged();
this.updateIndexHeadingVisibility();
}

private updateIndexHeadingVisibility() {
const indexAccordion =
document.querySelector<HTMLDetailsElement>(".tsd-index-content");
const oldOpen = indexAccordion?.open;
if (indexAccordion) {
indexAccordion.open = true;
}

// Hide index headings where all index items are hidden.
// offsetParent == null checks for display: none
Expand All @@ -73,5 +83,9 @@ export class Filter extends Component {

el.style.display = allChildrenHidden ? "none" : "block";
});

if (indexAccordion) {
indexAccordion.open = oldOpen!;
}
}
}

0 comments on commit af0d1b4

Please sign in to comment.