Skip to content
This repository has been archived by the owner on Jan 26, 2023. It is now read-only.

Remove the SVG title element #188

Closed
afercia opened this issue May 31, 2017 · 2 comments
Closed

Remove the SVG title element #188

afercia opened this issue May 31, 2017 · 2 comments

Comments

@afercia
Copy link

afercia commented May 31, 2017

See WordPress/gutenberg#528

The SVG title element is not consistently supported by assistive technologies and it's not sufficient to make a SVG accessible. To make SVGs accessible, many other features would need to be added, see: https://www.paciellogroup.com/blog/2013/12/using-aria-enhance-svg-accessibility/

However, there are additional considerations:

  • first: I don't think there's an easy way to translate the title element for proper localization, other than generating a complete set of SVGs for each language which is, I guess, a bit complicated
  • SVGs need the accessibility treatment described in the paciellogroup post only when they're used as not purely decorative images; since in the vast majority of cases they will be purely decorative, e.g. used as icons next to a text label, they should be completely hidden to assistive technologies and the only way to do that is to strip out the title element

As a general consideration, UI controls made of only icons are not accessible. Also, see some very interesting considerations about their usability: https://www.nngroup.com/articles/icon-usability/

Therefore, icon-only controls should be avoided. When really, really, needed, they should have at least a visible "tooltip" and should be made accessible as described in the paciellogroup post.
However, since it's impossible to programmatically distinguish when a SVG icon is purely decorative and when not, the best option is again to strip out the title element and address the accessibility during implementation, for example wrapping the SVG in an element with an aria-label attribute.

Lastly, worth noting the current title elements are, sometimes, not so accurate 🙂 Hearing screen readers announce "Video Alt3Embed" wouldn't help so much.

ie11 svg title

@ryelle
Copy link
Collaborator

ryelle commented May 31, 2017

Thanks for the issue & all the context @afercia — at the base of it, though, the request is just to remove the <title> from the generated SVG, is that correct? Maybe we can also update the examples to show accessible uses of the icons as well, but actual implementation is to be done in gutenberg or other individual projects.

@afercia
Copy link
Author

afercia commented May 31, 2017

the request is just to remove the <title> from the generated SVG, is that correct?

@ryelle correct, thanks 🙂 And yes, the implementation should be done in each project, see the linked issue above.

jasmussen added a commit that referenced this issue Jun 3, 2017
There's a lot of red here, but the only significant change is removing the title task in the gruntfile. All the built files are then regenerated from that change.

Fixes #188. CC: @afercia, can you take a look and see that this looks right? Thank you.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants