This repository has been archived by the owner on Oct 9, 2020. It is now read-only.
Apply idPrefix to references in aria-labelledby #68
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.
To make svgs more accessible to people with screen readers, we can make
use of a few elements and attributes:
<title>
to set a title for the image<desc>
to describe the image@aria-labelledby
to tell screen readers where the title and description are located in the treeHere's some more info on how to best use them:
https://css-tricks.com/accessible-svgs/#article-header-id-6
We're using svg-inline-loader over at brigade.com to make sure every svg has unique ids, but after adding accessibility markup we noticed that the references weren't right:
<title id="__C3oQyi-__shareIconTitle">Share Icon</title>Paper airline silhouette.
(I've manually removed some stuff from the above svg to make it shorter).
Notice how the references in aria-labelledby are now referencing missing ids. To fix this, we can apply the prefix here as well.
Apart from the above fix, I modified an assertion made in tests to be more robust.