You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you need validation state in a component, store the result with `useEffect` or call `suite.run()` inline during render (not in an effect that also resets state). See `ReviewAgreement.hooks.js` for the `useEffect`-based pattern.
**CRITICAL**: Data-viz components use a custom rounding scheme to avoid contradictory or broken labels. Never use `Math.round()` directly on chart percentages — always go through the shared helpers in `frontend/src/helpers/utils.js`.
356
+
357
+
#### Figma design rules (source of truth)
358
+
359
+
| Scenario | Display value |
360
+
|---|---|
361
+
| Value is exactly zero |`0%`|
362
+
| Non-zero value that rounds to 0% |`<1%` — never show `0%` for a real non-zero value |
363
+
| Dominant value that rounds to 100% while non-zero peers exist |`99%` — never show `100%` when other categories exist |
364
+
| Integer labels would otherwise sum to 99% or 101% | Use largest remainder so the displayed whole-number labels sum to `100%`|
365
+
| All other values | Rounded to nearest whole number |
366
+
367
+
**What NOT to show**: `>99%`, `0%` for non-zero values, `100%` when other non-zero items exist.
368
+
369
+
#### Three shared helpers (all exported from `utils.js`)
370
+
371
+
| Helper | Purpose |
372
+
|---|---|
373
+
|`computeDisplayPercent(value, total)`| Single-item display percent; returns `"<1"` instead of `0` for non-zero tiny values |
374
+
|`computeDisplayPercents(items)`| Cross-item normalisation; caps a dominant item at `99` and uses largest remainder so integer labels sum to `100` when possible |
375
+
|`applyMinimumArcValue(items, total)`| Floors arc slices to 1% of total **for chart geometry only** (never for legend labels) |
376
+
377
+
#### Why `"<1"`, `99`, and largest remainder exist
378
+
379
+
-`Math.round(0.4%)` → `0` — renders as "0%" in the legend, hiding a real slice.
380
+
-`Math.round(99.6%)` with a non-zero peer → `100%` — contradicts the peer's label (e.g. "100% + <1%").
381
+
-`Math.round(33.3%) + Math.round(33.3%) + Math.round(33.4%)` → `33 + 33 + 33 = 99` — the legend no longer adds up to the whole.
// Each item now has a `percent` field: integer (including 99 for capped dominant), or "<1"
391
+
// Example: 333/333/334 becomes 33/33/34 so the legend sums to 100%
392
+
```
393
+
394
+
```javascript
395
+
// ❌ INCORRECT: raw Math.round produces "0%" for tiny non-zero values
396
+
constpercent=Math.round((item.value/ total) *100); // may return 0 for <0.5%
397
+
```
398
+
399
+
#### Arc-visibility vs. legend values
400
+
401
+
`applyMinimumArcValue` is applied **inside `ResponsiveDonutWithInnerPercent`** automatically. Callers must **not** apply it before passing data to the component — it would corrupt the legend numbers. Supply the real `value` fields; the component floors arc geometry internally.
402
+
403
+
```javascript
404
+
// ✅ CORRECT: pass real values; arc flooring is automatic
`HorizontalStackedBar` filters and sizes bars by `item.value` (always numeric), **not** by `item.percent` (which may be the string `"<1"`). Ensure every segment object has a numeric `value` field alongside the display `percent`.
Copy file name to clipboardExpand all lines: docs/developers/frontend/accessibility/issue-5149-wave-3.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,7 +86,7 @@ Use Wave 3 to convert the existing accessibility baseline and regression-gate sc
86
86
-`npx cypress run --config-file ./cypress.config.js --headless --spec "cypress/e2e/agreementDetails.cy.js,cypress/e2e/budgetLineItemsList.cy.js,cypress/e2e/createAgreementWithValidations.cy.js,cypress/e2e/uploadDocument.cy.js"` passes
87
87
- no structural allowlist-backed failures remain in that targeted regression set
88
88
- Completed `svg-img-alt` burn-down for the remaining tracked specs:
89
-
- hid decorative portfolio legend and CAN funding icons from assistive tech in `frontend/src/components/Portfolios/PortfolioSummaryCards/PortfolioLegend.jsx` and `frontend/src/components/Portfolios/PortfolioFundingByCAN/PortfolioFundingByCAN.jsx`
89
+
- hid decorative portfolio legend and CAN funding icons from assistive tech in `frontend/src/components/Portfolios/PortfolioSummaryCards/PortfolioLegend.jsx` and `frontend/src/components/Portfolios/PortfolioFundingByCAN/PortfolioFundingByCAN.jsx` (note: `PortfolioFundingByCAN` was subsequently removed in #5515)
90
90
- hid decorative external-link icon in `frontend/src/components/Portfolios/PortfolioHero/HeroDescription.jsx`
91
91
- hid decorative budget line summary and change-action icons in `frontend/src/components/BudgetLineItems/BLIStatusSummaryCard/BLIStatusSummaryCard.jsx` and `frontend/src/components/BudgetLineItems/ChangeIcons/ChangeIcons.jsx`
92
92
- removed the final `svg-img-alt` allowlist entries from `frontend/cypress/support/a11yAllowlist.js`
0 commit comments