Skip to content

fix(a11y): add aria-label to LanguageIcon fallback dot and memoize component — #184#213

Merged
Jagadeeshftw merged 2 commits into
Grainlify:mainfrom
leocagli:fix/language-icon-184-a11y-memo
Jun 23, 2026
Merged

fix(a11y): add aria-label to LanguageIcon fallback dot and memoize component — #184#213
Jagadeeshftw merged 2 commits into
Grainlify:mainfrom
leocagli:fix/language-icon-184-a11y-memo

Conversation

@leocagli

Copy link
Copy Markdown
Contributor

Summary

  • The fallback colored dot for unknown languages had no accessible name — invisible to screen readers and colorblind users. Adds role="img" and aria-label={language} to the fallback <div>.
  • Wraps the component with React.memo to skip re-renders when props are unchanged.
  • Adds useMemo for the language-to-icon map lookup.

Test plan

  • Visual: unknown language (e.g. COBOL) now announced as "COBOL" by screen readers
  • Known languages already had <title>{language}</title> inside the SVG — unchanged
  • No logic changes; TypeScript compiles cleanly

Closes #184

🤖 Generated with Claude Code

leocagli and others added 2 commits June 23, 2026 13:30
The fallback colored dot had no accessible name, making unknown languages
invisible to screen readers and colorblind users. Adds role=img and
aria-label={language} to the fallback div. Wraps the component with
React.memo to skip re-renders when props are unchanged, and uses useMemo
for the language-to-icon lookup.

Closes Grainlify#184

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Jagadeeshftw Jagadeeshftw merged commit 86ef768 into Grainlify:main Jun 23, 2026
@Jagadeeshftw

Copy link
Copy Markdown
Contributor

adding the aria-label to the LanguageIcon fallback dot and memoizing the component is a clean a11y plus perf win. rebased on latest main and merged. thanks!

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.

Add accessible names and tooltips to LanguageIcon and memoize icon lookup

3 participants