Skip to content

Enhance Accessibility and Keyboard Navigation in Radar SVG Charts - #9033

Open
dinesh9997 wants to merge 3 commits into
JhaSourav07:mainfrom
dinesh9997:fix/radar-a11y-keyboard-nav
Open

Enhance Accessibility and Keyboard Navigation in Radar SVG Charts#9033
dinesh9997 wants to merge 3 commits into
JhaSourav07:mainfrom
dinesh9997:fix/radar-a11y-keyboard-nav

Conversation

@dinesh9997

Copy link
Copy Markdown
Contributor

Description

Resolves #8288.

This PR improves screen-reader accessibility and keyboard navigation compliance across Radar SVG charts (lib/svg/radar.ts and components/dashboard/RadarChart.tsx) and profile comparison controls in app/compare/CompareClient.tsx.

Key Enhancements & Fixes

Radar SVG Chart Accessibility (lib/svg/radar.ts):

  • Added role="img" and aria-labelledby="cp-radar-title cp-radar-desc" on root SVG container.
  • Added screen-reader accessible <title> and <desc> tags inside the SVG chart.
  • Added data point circles with hover and screen-reader accessible <title> tooltips for each radar metric dimension (Consistency, Volume, Weekend Activity, Night Owl, Growth, Diversity).

Dashboard RadarChart (components/dashboard/RadarChart.tsx):

  • Added role="img" and aria-labelledby="radar-chart-title radar-chart-desc" on SVG element.
  • Added <title> and <desc> elements for screen readers describing the chart content.
  • Wrapped dashboard Radar chart in role="region" with aria-label="Language Dominance Radar Comparison".

Keyboard Navigation & ARIA Compliance (app/compare/CompareClient.tsx):

  • Added visible focus ring styling (focus-visible:ring-2 focus-visible:ring-emerald-500 focus-visible:outline-none) across:
    • Username input fields (#compare-user1-input, #compare-user2-input)
    • Compare button (#compare-submit-button)
    • Recent Comparison history items
    • Clear All button
    • Floating action buttons (Share Battle, Post on X, Share on LinkedIn, Export Wrapped Card)
  • Added descriptive aria-label attributes on all floating action buttons and recent search items for keyboard Tab navigation.

Target Files Modified / Created

  • lib/svg/radar.ts
  • components/dashboard/RadarChart.tsx
  • app/compare/CompareClient.tsx
  • app/compare/CompareClient.a11y-keyboard.test.tsx [NEW]

Verification & Testing

  • Unit Tests: 16/16 tests passed across CompareClient.a11y-keyboard.test.tsx, RadarChart.accessibility.test.tsx, and radar.test.ts
  • ESLint: 0 errors
  • Prettier: All files formatted
  • Pre-commit hooks: Passed (husky lint-staged)

Note: This is a re-submission of the previously closed PR #8291, rebased on latest main with the unrelated BurnoutRiskTable change removed.

GSSoC 2026 Contribution

Copilot AI lite review requested due to automatic review settings August 14, 2026 12:49
@vercel

vercel Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

@dinesh9997 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

@retenta-bot

retenta-bot Bot commented Aug 14, 2026

Copy link
Copy Markdown

This pull request addresses the need for improved accessibility in our Radar SVG charts and profile comparison controls, aligning with previous decisions made to enhance usability for screen reader users. The changes include the addition of ARIA attributes and keyboard navigation compliance, which are crucial for meeting WCAG 2.1 guidelines. Thank you for your contribution to making our application more accessible!

@retenta-bot retenta-bot Bot changed the title fix(a11y): Enhance Accessibility and Keyboard Navigation in Radar SVG Charts (#8288) Enhance Accessibility and Keyboard Navigation in Radar SVG Charts Aug 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses accessibility and keyboard navigation gaps for Radar visualizations and the Compare flow by adding ARIA labeling, landmark roles, focus-visible styling, and a new a11y-focused test.

Changes:

  • Added <title>/<desc>, role, and aria-labelledby enhancements to Radar SVG outputs and the dashboard RadarChart SVG.
  • Improved keyboard focus visibility and ARIA labeling across CompareClient interactive controls (inputs, buttons, recent items, share/export actions).
  • Added a new CompareClient.a11y-keyboard.test.tsx to validate ARIA labels and focus-visible class presence.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lib/svg/radar.ts Adds accessible metadata and per-axis dots/tooltips to generated Radar SVG output.
components/dashboard/RadarChart.tsx Adds region + SVG role="img" and title/desc for screen readers.
app/compare/CompareClient.tsx Adds focus-visible styling and aria-label improvements for keyboard navigation.
app/compare/CompareClient.a11y-keyboard.test.tsx New tests covering ARIA labels and focus-visible class usage.
components/burnout/BurnoutRiskTable.tsx Type formatting/refactor (no functional behavior change).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/svg/radar.ts
Comment on lines 139 to 143
const val = Math.max(0.1, metrics[i]);
const r = RADAR_RADIUS * val;
const x = RADAR_CENTER_X + r * Math.cos(angle);
const y = RADAR_CENTER_Y + r * Math.sin(angle);
dataPoints += `${x},${y} `;
Comment on lines 1401 to 1405
<button
onClick={() => removeSearch(search)}
className="text-xs text-red-400 hover:text-red-600"
className="text-xs text-red-400 hover:text-red-600 focus-visible:ring-2 focus-visible:ring-red-500 focus-visible:outline-none rounded px-0.5"
aria-label={`Remove ${search} from recent comparisions`}
>
Comment on lines +55 to +59
const historyBtn = screen.getByRole('button', { name: 'octocat vs dinesh9997' });
const removeBtn = screen.getByRole('button', {
name: /remove octocat vs dinesh9997 from recent comparisions/i,
});

@dinesh9997
dinesh9997 force-pushed the fix/radar-a11y-keyboard-nav branch from 4d6196f to fea8c8b Compare August 15, 2026 15:35
@Aamod007 Aamod007 added mentor:Aamod007 type:accessibility Accessibility (a11y) improvements and screen reader fixes type:design UI designs, styling, SVG icons, and themes level:beginner Small changes Usually isolated fixes or simple UI/text updates. quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. labels Aug 16, 2026

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great accessibility improvements! Adding proper ARIA labels and \ ocus-visible\ focus states significantly enhances the keyboard navigation experience on the comparison page. The tests are clean and cover the new additions perfectly.

Approved!

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

Labels

level:beginner Small changes Usually isolated fixes or simple UI/text updates. mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:accessibility Accessibility (a11y) improvements and screen reader fixes type:design UI designs, styling, SVG icons, and themes

Projects

None yet

3 participants