Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I think the best way to address the accessibility issues of using the FontAwesome library is to add the following aria-label="Accessibility icon" role="image"
to the HTML tag that you are using.
I'd like to see more testing with this, but I think it works alright. When we clarify this, would be good to add it to this module's docs.
Comments
Comment #1
markhalliwellPer the discussions in #1849712: Add theming template and prepare logic for rendering icons, #1836160: Support icon fonts in menu links, #1979088: Discussion of standards and general conciseness around the web; icon accessibility should be made invisible so screen-readers don't pick them up:
aria-hidden="true"
. This is automatically applied to any icon using the Icon API:In template_preprocess_icon() line 75:
Comment #2
markhalliwellPS: normally I don't like hi-jacking issues, but I really would dislike to see others (mainly rob) waste time on something that I'd really like to consolidate into just one project; given the amount of discussions and time that has already been put into develop a comprehensive approach for this long overdue issue in Drupal. I'd rather see focus on making the API better so we could eventually put some iteration of it in core.
Comment #3
mgiffordTotally think it's worth while linking in other related issues. Particularly when it comes to Core.
You state "general conciseness around the web; icon accessibility should be made invisible so screen-readers don't pick them up", and I don't agree that there is consensus on this in the accessibility community.
If you're using them as a bullets or whatever, then fine. But they are becoming powerful enough now that they are able to convey in many cases more meaning than an image. In most cases images still require alt text unless they are simply spacer elements.
Often the icons are actually used as links, so some text option is required.
https://github.com/FortAwesome/Font-Awesome/issues/589
Comment #4
markhalliwellReferencing:
#1849712: Add theming template and prepare logic for rendering icons
#1836160: Support icon fonts in menu links
Actually, I completely agree with you. I perhaps probably should have explained more about what I was talking about. I don't think the icons themselves shouldn't be readable. We should probably have a "label" or "title" that would prepend/append the icon. This would allows up to have a tooltip pop-up (using the title attribute) on the icon and also give screen-readers the ability to read the icon (with the hidden element). We need this separation for reasons pertaining to styling.
This is actually already do-able with the
icon_menu
sub-module in the Icon API. Simply wrap the menu item's "title" with a wrapper and give it the class "element-invisible".Comment #5
mgiffordRight, it certainly can be a problem if a screen reader tries to pronounce it.
Font Awesome was also brought up recently because of this post:
http://www.nczonline.net/blog/2013/04/01/making-accessible-icon-buttons/
By @droplet here #1719640: Use 'button' element instead of empty links
Interesting to see how widely they may be used in the near future.
Comment #6
markhalliwellYes, I'm aware of the
<button/>
method. I was under the impression though (from all the posts I've read), that the label/title accessibility portion usually pertains to the wrapping or adjoining markup yes? Thearia-hidden="true"
would pertain to the icon itself, yes?PS, the
<a href="#">...</a>
in the example above should have read<a href="/">...</a>
as if it were part of the menu system links. I don't think we want to make these buttons ;)Comment #7
mgiffordI haven't done the serious testing that's needed for either
<button>
or Font Awesome icons.Are you coming to DrupalCon Portland? Might be an interesting session for a BoF.
Comment #8
mgiffordInteresting post on a11y & font awesome - http://www.chriskevin.se/en/blogg/2013/05/13/font-awesome-accessibility-...
I haven't tested this, but appreciate it.
Comment #8.0
mgiffordadding call to action.
Comment #9
truls1502I believe we have it included. If you find any bugs or the module is not accessibility yet, please change the status, and we would be happy if you could point wherein the code that needs to be fixed. If you can or have a patch to it, we appreciate for contribution. :)
Comment #10
truls1502Please reopen the issue later if you or someone is still facing the same problem, please correct the right version.
Comment #11
truls1502Please to reopen the issue, if you still face the issue :)