More actions
No edit summary |
No edit summary |
||
| Line 24: | Line 24: | ||
}); | }); | ||
// Helper: Expand citizen-section | // Helper: Expand any collapsed parent citizen-section containing the heading | ||
function expandCitizenSectionFromHeading(heading) { | function expandCitizenSectionFromHeading(heading) { | ||
if (!heading) return; | if (!heading) return; | ||
| Line 30: | Line 30: | ||
let current = heading; | let current = heading; | ||
while (current) { | while (current) { | ||
// If we find a collapsed citizen-section content block, expand it | |||
if (current.classList && current.classList.contains('citizen-section') && current.hidden) { | |||
current.hidden = false; | |||
} | |||
// If we reach a section heading, stop | |||
if (current.classList && current.classList.contains('citizen-section-heading')) { | if (current.classList && current.classList.contains('citizen-section-heading')) { | ||
break; | break; | ||
} | } | ||
current = current.parentElement; | current = current.parentElement; | ||
} | } | ||
} | } | ||
// === Handle direct URL loads with a hash (on page load) === | // === Handle direct URL loads with a hash (on page load) === | ||