Skip to content

Commit

Permalink
cci: normalize heading before +overlay
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ChlodAlejandro committed Apr 24, 2024
1 parent df82208 commit 7ab7b28
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/session/DeputyRootSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down

0 comments on commit 7ab7b28

Please sign in to comment.