mirror of
https://github.com/vinta/awesome-python.git
synced 2026-10-02 08:23:10 +08:00
fix: restore hidden group headings when navigating to a jump link
After sorting by a column, or while a search hid a group, category page group headings stayed hidden, so the header's jump links (and any use-case heading link) pointed at a hidden element and did nothing. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -364,6 +364,24 @@ sortHeaders.forEach(function (th) {
|
||||
});
|
||||
});
|
||||
|
||||
// Group headings are hidden while sorted flat or filtered out by search, so a link to one must restore them first
|
||||
document.addEventListener("click", function (e) {
|
||||
const link = e.target.closest('a[href*="#"]');
|
||||
if (!link || link.pathname !== location.pathname) return;
|
||||
const heading = document.getElementById(decodeURIComponent(link.hash.slice(1)));
|
||||
const groupRow = heading ? heading.closest(".group-row") : null;
|
||||
if (!groupRow) return;
|
||||
if (activeSort.col !== "editorial") {
|
||||
activeSort = defaultSort;
|
||||
sortRows();
|
||||
updateSortIndicators();
|
||||
}
|
||||
if (groupRow.hidden && searchInput) {
|
||||
searchInput.value = "";
|
||||
applyFilters();
|
||||
}
|
||||
});
|
||||
|
||||
if (searchInput) {
|
||||
let searchTimer;
|
||||
searchInput.addEventListener("input", function () {
|
||||
|
||||
Reference in New Issue
Block a user