Icons can convey all sorts of meaningful information, so it's important that they reach the largest amount of people possible.
Font Awesome Icons and Accessibility
There are a good number of folks with sight and hearing impairments: blindness, low vision, and visual impairment represent almost 10% of the total world population and disabling hearing loss represents over 5% of the total world population.
So we've built ways to help technology that supports impairments, like screen readers, either ignore or better understand the Font Awesome icons you're using.
There are two ways that icons are used on websites, apps, and other digital places:
|Icon Use ||What to Do|
|For Decorative Elements ||If you're using an icon to add some extra decoration or branding, it does not need to be announced to users as they are navigating your site or app aurally. Additionally, if you're using an icon to visually re-emphasize or add styling to content already present in your HTML, it does not need to be repeated to an assistive technology-using user. In these cases, the icon should be hidden from the screenreader so it doesn't interfere with the established meaning.|
|For Semantic or Interactive Purposes ||When you're using an icon to convey meaning, you need to make sure that this meaning is also conveyed to users by providing text-based alternatives. This goes for content you're abbreviating via icons (e.g. shopping cart status, number of unread messages, etc.) as well as interactive controls (e.g. buttons, form elements, toggles, etc.).|
Auto-Accessibility with Kits
The easiest way to support accessible icons is with a Font Awesome Kit. Every Kit comes with auto-accessiblity built-in and provides the modern and proper syntax assistive technologies recognize.
Here's how it works:
For Icons That Are Decorative
Font Awesome auto-accessibility feature will make sure it is ignored by assistive technology. There's nothing extra you need to on top of how you would usually reference an icon.
If your markup looks like this:
The Font Awesome Kit will hide it from screenreaders using the
For Icons That Have Semantic or Interative Meaning
The Font Awesome auto-accessibility feature will create alternative text for the icon using the description you set with the
So if your markup looks like this:
The Font Awesome Kit will adjust it so the meaning is conveyed in supporting elements that only screenreaders "see":
Manually Make Your Icons Accessible
If you are hosting yourself, you can manually set-up accessibility for your icons using the instructions below, for either Web Fonts and CSS, SVG and JS, SVG Sprites .
Accessiblility with Web Fonts with CSS
Accessibility for webfonts takes a bit more work, as the Webfont with CSS method can't add any attributes or elements to your HTML, but is well worth the effort. You'll just need to consider whether your icon is just decorative or has semantic meaning.
If your icons are purely decorative, you'll need to manually add an
aria-hidden attribute to each of your icons so they're accessible.
If your icons have semantic meaning, you'll need to manually add a few things so that your icon is appropriately accessible:
- Provide a text alternative inside a
<span> (or similar) element. Also include appropriate CSS to visually hide the element while keeping it accessible to assisitive technologies. Our style toolkit includes a
fa-sr-only based on best practices(opens new window) to handle that hiding.
title attribute on the icon to provide a tooltip for sighted mouse users.
|Visually hides an element containing a text-equivalent for an icon while keeping it accessible to assisitive technologies|
|Used alongside |
fa-sr-only to show the element again when it’s focused (e.g. by a keyboard-only user)
In the case of focusable interactive elements, there are various options to include an alternative text or label to the element, without the need for any visually hidden
<span> or similar. For instance, simply adding the
aria-label attribute with a text description to the interactive element itself will be sufficient to provide an accessible alternative name for the element. If you need to provide a visual tooltip on mouseover/focus, we recommend additionally using the
title attribute or a custom tooltip solution.
An icon being used to communicate shopping cart state:
An icon being used as a link to a navigation menu:
An icon being used as a delete button's symbol with a title attribute to provide a native mouse tooltip:
Our SVG+JS method uses the same auto-accessibility feature that is part of Kits. When your icon conveys meaning, we add supporting HTML elements and attributes so that your icons are accessible to the widest audience possible.
When your icon has semantic meaning, all you need to do is throw a
title="meaning" attribute. Auto-accessibility takes care of the rest, adding the following:
- Proper ARIA role (
title tag with a proper
id attribute, based upon the
title attribute given to the icon
aria-labelledby attribute and wire it to the
You can control the
id attributes generated by specifying
data-fa-title-id. This is useful
for some testing frameworks that use snapshots to verify test results.
If your icons are purely decorative, you're already done! We'll make sure screenreaders don't try to read the icon out.
Our auto-accessibility automatically adds
role="img" to your inline SVG attributes so that your icons are properly accessible.
Accessiblility with SVG Sprites
role for decorative sprites.
Animating Icons and Accessiblility
Font Awesome comes bundled with basic animations in our support styling. These animations now support and leverage the
prefers-reduced-motion CSS media feature(opens new window) to detect if a user has requested that the system minimize the amount of non-essential motion it uses.
|Case ||How It Affects Included Animations|
|No preference set (default) ||Animations will render as expected|
|Preference set to |
|Animations will be disabled|
prefers-reduced-motion is set to
reduce, the user prefers less motion on the page to help reduce discomfort from vestibular motion disorders and other motion sensitivities.
Other Cases and Information
While the scenarios and techniques here help avoid some serious issues and confusion, they are not exhaustive.
There are many complex contexts and use cases when it comes to accessibility, such as users with low vision who need a high color contrast ratio to see UI. There are some great tools and resources to learn from and work on these issues out there. Here are a few reads we recommend:
We'll continue to work on these under the larger topic of accessibility, but in the meantime, let us know if any bugs or issues.