Fix HTML validation regarding SVG images#7721
Merged
mrcasals merged 7 commits intodecidim:developfrom Mar 26, 2021
Merged
Conversation
Contributor
|
@ahukkanen tests are failing! |
Contributor
Author
|
@mrcasals The failing spec is fixed. |
36 tasks
mrcasals
approved these changes
Mar 26, 2021
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? Why?
In #7663 I added the
role="presentation"to the SVG images which was suggested at:dequelabs/axe-core#1462
And this is not even the only resource if you search online.
The problem is that this breaks HTML validation, as you can see here:
validator/validator#981
I will not revert #7663 because it still applies some other important changes but the take from all this is:
<svg>images needrole="img"to pass HTML validation<svg>has arole="img"it needs to have an alternative text througharia-labelto pass accessibility validation<svg>'s also need the<title>element (which needs to match thearia-label)titleandaria-labelare undefined for the icon, we now force thearia-hidden="true"attribute on the SVG.This PR makes both accessibility evaluation tools and HTML validation tools happy.
SIDENOTE: We need some automated testing to the CI pipeline to catch all these, so we don't have to change it back and forth and fix over and over again. I'll come back to this once we get all these accessibility fixes merged, I have an idea how to implement it.
📌 Related Issues
Testing
📋 Checklist
docs/.