Skip to content

Akshay fix overlapping center labels on Volunteer Status donut charts - #5445

Open
akv-iu wants to merge 3 commits into
developmentfrom
Akshay_fix_donut_center_label_overlap
Open

Akshay fix overlapping center labels on Volunteer Status donut charts#5445
akv-iu wants to merge 3 commits into
developmentfrom
Akshay_fix_donut_center_label_overlap

Conversation

@akv-iu

@akv-iu akv-iu commented Aug 14, 2026

Copy link
Copy Markdown
image

Description

Bug: Both donut charts in the Volunteer Status section render overlapping, unreadable text in their centers.

  • Total Volunteers chart: the count (e.g. 2544) collides with the TOTAL VOLUNTEERS* label directly above it — neither is readable.
  • Total Mentors chart: the count (e.g. 83) is painted on top of the TOTAL MENTORS label.

Path to reproduce: Manager / Admin / Tester login → Dashboard (Under Reports)→ Total Org Summary → Global Distribution and Volunteer Status Overview → Volunteer Status

Root cause: the donut "center" is an absolutely-positioned HTML overlay (<h2> + <p>) stacked on top of the chart canvas. Its vertical spacing was hand-tuned with offsets that reserve no layout space. Measured in a headless Chrome repro using the real CSS:

TOTAL VOLUNTEERS*  →  gap to count =  0.0px
TOTAL MENTORS      →  gap to count = -2.0px   (boxes actually overlap)
  • MentorStatusPieChart.module.csstransform: translateY(6px) on the heading paints it 6px lower but reserves no space, while margin-top: -10px pulls the count up. Net: -2px of box overlap and ~8px of painted overlap, against only 2.1px of half-leading on the count.
  • VolunteerStatusPieChart.module.cssmargin: 0 auto on the heading was written to centre the block, but the shorthand also wipes the <h2>'s bottom margin, leaving 0px of separation. max-width: 90% on a shrink-to-fit absolute parent also forces the label to wrap to two lines, so the descender row sits flush against the count.

Both are amplified by font-size: clamp(..., 8.36cqw, ...): the text scales with container width while the 6px / -10px offsets stay fixed in px, so the tuning only holds at one exact width.

Related PRS (if any):

None. This is a frontend CSS-only change; no backend PR is required.

Main changes explained:

  • Update src/components/TotalOrgSummary/VolunteerStatus/MentorStatusPieChart.module.css — removed transform: translateY(6px) from the heading and margin-top: -10px from the count, and zeroed the margins on the heading, count and comparison line so the existing flex gap: 6px is the only thing setting the spacing.
  • Update src/components/TotalOrgSummary/VolunteerStatus/VolunteerStatusPieChart.module.css — made the center block a flex column with gap: 6px (matching the mentor chart) and zeroed the default p margins so Bootstrap's margins stop fighting the gap.

The magic offsets are deleted rather than re-tuned, so the spacing no longer breaks when the container-query (cqw) font scaling changes the text size.

Measured result (headless Chrome, production CSS + the app's Bootstrap build, heading-bottom to count-top):

Before After
Total Volunteers 0.0px 6.0px
Total Mentors -2.0px (overlapping) 6.0px

Gaps are a uniform 6.0px on both charts, with and without the comparison line shown.

How to test:

  1. Check into this branch
  2. Run npm install, then npm run start:local
  3. Clear site data / cache
  4. Log in as Owner / Admin, then repeat as Manager and Tester
  5. Go to Dashboard → Total Org Summary → expand Global Distribution and Volunteer Status OverviewVolunteer Status
  6. Verify the Total Volunteers donut shows TOTAL VOLUNTEERS* and the count on separate, fully readable lines
  7. Verify the Total Mentors donut shows TOTAL MENTORS and the count on separate, fully readable lines
  8. Change the comparison dropdown from No Comparison to Week Over Week / Month Over Month / Year Over Year — the extra percentage-change line must also stay clear of the count
  9. Resize the browser across the 768px and 1200px breakpoints (the charts re-flow and the font scales with container width) and confirm the text never collides at any width
  10. Verify all of the above in dark mode
  11. Click Save as PDF on the Total Org Summary header and confirm the exported PDF shows the same readable centers

Screenshots or videos of changes:

image image

Note:

  • Scope is deliberately limited to the two center-overlay stylesheets. The max-width: 90% vs width: 100% inconsistency between the two headings and the un-constrained center block width are noted but left alone — happy to raise those as a separate PR if reviewers want them addressed.
  • Verified with a headless-Chrome repro of the two center overlays using the production CSS plus the app's Bootstrap build, which is where the 0.0px / -2.0px measurements above come from.

@netlify

netlify Bot commented Aug 14, 2026

Copy link
Copy Markdown

Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit 8bd8c01
🔍 Latest deploy log https://app.netlify.com/projects/highestgoodnetwork-dev/deploys/6a7fbe3898a03700086e4ec4
😎 Deploy Preview https://deploy-preview-5445--highestgoodnetwork-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

akv-iu and others added 2 commits August 13, 2026 23:07
The donut center is an absolutely positioned HTML overlay whose spacing was
tuned with offsets that reserve no layout space. On the mentor chart a
translateY(6px) on the heading plus margin-top: -10px on the count left -2px
between their boxes; on the volunteer chart margin: 0 auto wiped the h2 bottom
margin, leaving 0px. Both collapse further because the font-size scales with
container width (cqw) while the offsets stayed fixed in px.

Delete the offsets and let a flex column gap do the spacing on both charts.
Measured heading-to-count gap goes from 0.0px / -2.0px to a uniform 6.0px,
including when the comparison line is shown.
Value and percentage are already shown permanently via the
externalLabelGuides canvas plugin. The default Chart.js tooltip
duplicated that info and rendered its dark box directly on top of the
external label on hover, reading as overlapping/garbled text.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@akv-iu
akv-iu marked this pull request as ready for review August 15, 2026 01:16
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant