-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SVG icons accessibility #528
Comments
At first look buttons (SVGs inside them) definitely need to be announced. At this point Okay in there we used We can look this example more |
I think we might want to move this issue to the dashicons repo instead: https://github.com/WordPress/dashicons |
This is admittedly an are where I don't have a ton of expertise. But the titles were added initially due to reading this: https://css-tricks.com/accessible-svgs/ I don't proclaim to note that article is wither right nor wrong. But I do know that it would be easy for us to remove the title from the grunt script that builds the dashicons component. But this has to happen upstream in https://github.com/WordPress/dashicons, so I'm closing this one. Feel free to open a ticket there, and I volunteer to shepard it through. |
Thanks @jasmussen I've just opened WordPress/dashicons#188 However, as I've tried to explain on WordPress/dashicons#188, that's not what we need in the vast majority of cases. Reopening this issue because when the title element will be removed upstream, there will still be the need to wrap the SVG icons in some element of your choice (e.g. a span). Worth considering UI controls made of only icons should be avoided for the reasons mentioned in WordPress/dashicons#188 Purely decorative SVGs need to be hidden from assistive technologies: SVGs that need to be communicated (to avoid): |
This removes the title element from the sprite. This should finally fix #528.
Reopening per remaining task noted at #1012 (comment) |
@aduth is this concluded? |
Icons otherwise should be implemented "correctly" by the consuming component. We have some helpers here in case of In the case of InserterMenu, we're not using IconButton, but provide the full title of the block adjacent the icon, and the icon is otherwise hidden from assistive tools (via Or so goes my understanding. All the same, if there's remaining problems, they should be surfaced as individual actionable issues. |
SVG icons are tricky for accessibility. Some browsers/screen readers combinations announce the SVG
<title>
(if any) no matter what you try to do to avoid it. Even addingaria-hidden="true"
to the icons doesn't work for some combos.IE 11 + NVDA:
IE 11 and AViewer (see the SVG title is part of the calculated accessible name):
Are the
<title>
really needed? Is there any case where we'd want the SVG icons to be announced? I guess the titles could be entirely removed, and when UI controls that use the icons need to be labeled, that could be done on the controls, for example:<button aria-label="Some label here"><SVG here></button>
@davidakennedy and @samikeijonen could chime in here, they have a lot of experience with SVG icons for all the job done for Twenty Seventeen 🙂
The text was updated successfully, but these errors were encountered: