fix(a11y): do not assign aria-labelledby attribute to icons unless there is an associated title #4073
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.
See docs team ticket for context.
It looks like Paste Icons assign an
aria-labelledby
attribute to all icons, even if there is no<title />
element that can be referenced by the matchingtitleId
. This is throwing warnings in the 'wave' a11y tool mentioned in our QA ticket for the Twilio Docs but you can see the same issue in the Paste docs or anything else that uses Paste Icons and/or the Button with link functionality (which renders a button containing adecorative
arrow icon).My fix is to only assign this aria attribute if there will be a valid
<title />
element to reference, avoiding the a11y error/warning.Without this change (a page with lots of Buttons as links, which render an
<ArrowForwardIcon decorative />
internally:With this change made directly to the Paste icons source in
node_modules/
:Contributing to Twilio