Skip to content

fix(web): add accessible legend to dashboard trends - #1858

Merged
joshunrau merged 2 commits into
DouglasNeuroInformatics:mainfrom
joshunrau:fix/1782-dashboard-trend-legend
Nov 3, 2026
Merged

joshunrau merged 2 commits into
DouglasNeuroInformatics:mainfrom
joshunrau:fix/1782-dashboard-trend-legend

Conversation

@joshunrau

Copy link
Copy Markdown
Collaborator

Fixes #1782. Supersedes #1819.

The dashboard's Records & Sessions Trend chart told its two series apart only by colour and the hover tooltip (WCAG 1.4.1).

  • Adds a recharts <Legend /> so both series are labelled without hovering.
  • Gives each Area a translated name (en/es/fr), so the legend reads in the interface language.
  • Draws the sessions series dashed with legendType="plainline", so the line and its legend icon differ by more than colour.
  • Defines the "Records" and "Sessions" labels once and uses them in both the tooltip and the legend, so the two cannot drift apart.

The first commit is @misaelalves99's work from #1819, kept with their authorship. The second commit applies the review feedback that PR never picked up.

Verification

  • Unit: apps/web/src/routes/_app/__tests__/dashboard.test.tsx (34/34) checks that the legend appears only on the trend chart, the series names in all three languages, and that only sessions is dashed.
  • E2E: testing/src/specs/dashboard.spec.ts checks that the legend is visible with both labels and that only the sessions icon is dashed.
  • pnpm --filter @opendatacapture/web lint passes. The full pnpm lint, test:coverage and test:e2e were not run locally; CI runs them.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

misaelalves99 and others added 2 commits November 3, 2026 08:43
The legend's series names repeated the tooltip's inline "Records" and
"Sessions" translations, so the two could drift apart. Both now read from
one recordsLabel and one sessionsLabel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@joshunrau
joshunrau merged commit b71b710 into DouglasNeuroInformatics:main Nov 3, 2026
2 checks passed
@joshunrau
joshunrau deleted the fix/1782-dashboard-trend-legend branch November 4, 2026 20:04
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.

Dashboard Records & Sessions chart has no legend, so its two series can only be told apart by colour

2 participants