Remove role attributes on SVGs meant for "decoration" to improve a11y#38301
Conversation
|
I discovered that correcting this issue actually touches virtually every part of the Gutenberg interface. The SVG primitive was also adding the |
Mamaduka
left a comment
There was a problem hiding this comment.
It looks like there are a few more snapshots that need an update.
|
Yeah that last change to the SVG seems to have touched a lot of tests. I will remedy today. |
aristath
left a comment
There was a problem hiding this comment.
Code here looks good and is a small - but important - improvement.
I'll go ahead and pre-approve this PR so it can be merged as soon as all tests are fixed 👍
|
One of the tests is still failing here... @ndiego could you please rebase the PR? That should fix the error here. If it doesn't, then we should take another look and see if there's something wrong 👍 |
|
Looks like everything has passed after the rebase. Merging 🙌 |
Description
Fixes #38286
In many places throughout Gutenberg, we render SVGs with
role="img"but we do not include anaria-label. At first glance this may seem ok because in all instances we also have something like this:However,
aria-hidden="true" focusable="false"is sufficient here. Since we are includingrole="img", there should also be anaria-labelas described here in the MDN Wed Docs. The solution is to simply remove theroleattribute. Refer to #38286 for further discussion on why this is the correct approach.Testing Instructions
role="img"is no longer added to all SVG icons. 🙌Screenshots
Types of changes
Bug fix
Checklist:
*.native.jsfiles for terms that need renaming or removal).