Repository navigation
fix(icons): forward ariaLabel to the svg as aria-label - #1791
Merged
Merged
Conversation
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>
|
Contributor
|
🚀 Deployed on https://pr-1791--dhis2-ui.netlify.app |
kabaros
approved these changes
Nov 18, 2026
Contributor
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What
Icon components have accepted an
ariaLabelprop since #1462 (it's in the template, the types andAPI.md), buticons/svgr.config.jsnever 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 tosvgProps. WhenariaLabelisn't set, React omits the attribute, so unlabelled icons render as before.Related: #1447
Verification
aria-label={ariaLabel}on the<svg>.Not in this PR
role="img"when labelled,aria-hiddenotherwise). This would hide every unlabelled icon from assistive tech across all apps, so it needs a team decision first.icons/__tests__/svgr.test.jsdoesn't run. The root Jest config only coverscollections/andcomponents/, 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