More actions
No edit summary |
No edit summary |
||
| Line 27: | Line 27: | ||
function expandCitizenSectionFromHeading(heading) { | function expandCitizenSectionFromHeading(heading) { | ||
if (!heading) return; | if (!heading) return; | ||
// If the clicked ID is on a <span> inside a heading, go up to the heading | |||
if (heading.tagName === 'SPAN' && heading.parentElement && heading.parentElement.classList.contains('citizen-section-heading')) { | |||
heading = heading.parentElement; | |||
} | |||
// Case 1: Heading itself is a .citizen-section-heading | // Case 1: Heading itself is a .citizen-section-heading | ||
| Line 44: | Line 49: | ||
} | } | ||
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; | ||
} | } | ||
} | } | ||
// Helper: True final scroll to real heading, after layout is ready | // Helper: True final scroll to real heading, after layout is ready | ||