From 7ab7b28e12f6b419a1a0d126bd97afb4cdfd45f9 Mon Sep 17 00:00:00 2001 From: Chlod Alejandro Date: Wed, 24 Apr 2024 10:21:54 +0800 Subject: [PATCH] cci: normalize heading before +overlay Heading is not normalized before "Start working on section" overlay is added, causing a bit of spillover into the next section. Minor visual bug, but annoying nonetheless. --- src/session/DeputyRootSession.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/session/DeputyRootSession.ts b/src/session/DeputyRootSession.ts index 9fc7ef47..af6d1938 100644 --- a/src/session/DeputyRootSession.ts +++ b/src/session/DeputyRootSession.ts @@ -508,15 +508,17 @@ export default class DeputyRootSession { * @param heading */ addSectionOverlay( casePage: DeputyCasePage, heading: ContributionSurveyHeading ): void { - const section = casePage.getContributionSurveySection( heading ); + const normalizedHeading = casePage.normalizeSectionHeading( heading ); + const section = casePage.getContributionSurveySection( normalizedHeading ); const list = section.find( ( v ) => v instanceof HTMLElement && v.tagName === 'UL' ) as HTMLUListElement; - const headingTop = window.scrollY + heading.getBoundingClientRect().bottom; + const headingTop = window.scrollY + + normalizedHeading.getBoundingClientRect().bottom; const sectionBottom = window.scrollY + ( findNextSiblingElement( last( section ) )?.getBoundingClientRect()?.top ?? - heading.parentElement.getBoundingClientRect().bottom + normalizedHeading.parentElement.getBoundingClientRect().bottom ); const overlayHeight = sectionBottom - headingTop; if ( list != null ) {