Skip to content

fix(icons): forward ariaLabel to the svg as aria-label - #1791

Merged
kabaros merged 1 commit into
masterfrom
fix/icons-aria-label
Nov 18, 2026
Merged

kabaros merged 1 commit into
masterfrom
fix/icons-aria-label

Conversation

@cooper-joe

Copy link
Copy Markdown
Member

What

Icon components have accepted an ariaLabel prop since #1462 (it's in the template, the types and API.md), but icons/svgr.config.js never mapped it onto the root <svg>. The prop was silently dropped, so <IconAdd16 ariaLabel="Add" /> rendered with no accessible name.

This adds the missing aria-label: '{ariaLabel}' entry to svgProps. When ariaLabel isn't set, React omits the attribute, so unlabelled icons render as before.

Related: #1447

Verification

  • Regenerated all 264 icons with the updated config; every one now renders aria-label={ariaLabel} on the <svg>.

Not in this PR

  • Decorative vs meaningful semantics (role="img" when labelled, aria-hidden otherwise). This would hide every unlabelled icon from assistive tech across all apps, so it needs a team decision first.
  • icons/__tests__/svgr.test.js doesn't run. The root Jest config only covers collections/ and components/, and the test fails when run directly. Its snapshot still reflects the pre-chore: update icon accessibility #1462 template. Left as a follow-up.

🤖 Generated with Claude Code

The icon template has accepted an ariaLabel prop since #1462, but the
svgr config never mapped it onto the root svg, so the label was dropped
and screen readers got no accessible name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cooper-joe
cooper-joe requested a review from a team as a code owner November 18, 2026 08:04
@sonarqubecloud

Copy link
Copy Markdown

@dhis2-bot

Copy link
Copy Markdown
Contributor

🚀 Deployed on https://pr-1791--dhis2-ui.netlify.app

@dhis2-bot
dhis2-bot temporarily deployed to netlify November 18, 2026 08:07 Inactive
@kabaros
kabaros merged commit 7be79f6 into master Nov 18, 2026
18 checks passed
@kabaros
kabaros deleted the fix/icons-aria-label branch November 18, 2026 08:12
dhis2-bot added a commit that referenced this pull request Nov 18, 2026
## [10.21.1](v10.21.0...v10.21.1) (2026-11-18)

### Bug Fixes

* **icons:** forward ariaLabel to the svg as aria-label ([#1791](#1791)) ([7be79f6](7be79f6)), closes [#1462](#1462)
* **select:** improve disabled state handling and accessibility ([#1789](#1789)) ([fe87063](fe87063))
@dhis2-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 10.21.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

This branch was previously deployed

1 inactive deployment
netlify — 83810841 Deployed Nov 18, 2026 by dhis2-bot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants