Skip to content

Accessibility

Icons can convey all sorts of meaningful information, so it’s important that they reach the largest number of people possible.

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 it’s important to ensure that the assistive technology supporting impairments, like screen readers, either ignore or better understand the icons you’re using on the web.

There are two ways that icons are used on websites, apps, and other digital places…

Icon UseWhat to Do
Decorative ElementsIf 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.

Font Awesome icons are hidden from assistive technology by default, so they don’t interfere with the established meaning in these cases.
Semantic ElementsWhen 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.).

Say you have the following markup:

<button type="submit">
<i class="fa-solid fa-envelope"></i> Email Us!
</button>

The text inside the button explains the meaning of the button: “Email us!“. Assistive technology, such as screen readers, will read this out, so it’s clear what’ll happen when you press the button. The screen reader shouldn’t announce that there’s an icon present, as it is purely decorative.

Accessible Decorative Icons With Web Fonts

Section titled “Accessible Decorative Icons With Web Fonts”

By default, Font Awesome web font icons are ignored by assistive technology. So you’re all set!

SVG icons injected via your Font Awesome Kit or the self-hosted SVG + JS method will automatically get an aria-hidden="true" attribute, so they’re hidden from assistive technology such as screen readers.

Let’s look at our previous example, but now with SVG icons automatically inserted via a Kit:

<button type="submit">
<svg aria-hidden="true" class="svg-inline--fa fa-envelope" data-prefix="fas" data-icon="envelope" role="img" viewBox="0 0 512 512">
<path d="M48 64C21.5 64 0 85.5 0 112c0 15.1 7.1 29.3 19.2 38.4L236.8 313.6c11.4 8.5 27 8.5 38.4 0L492.8 150.4c12.1-9.1 19.2-23.3 19.2-38.4c0-26.5-21.5-48-48-48H48zM0 176V384c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V176L294.4 339.2c-22.8 17.1-54 17.1-76.8 0L0 176z"></path>
</svg>
Email Us!
</button>

If you manually inline our SVG icons, either directly or with sprites, you’ll have to add the aria-hidden="true" yourself.

There are two common use cases for semantic icons: as a visual cue inside an interactive element like a button, or alongside text to provide added context. Let’s look at how to deal with them both.

When your icon is the only visual element in an interactive element, the icon should explain what it does. For example, a button with an icon of an envelope suggests that pressing it will let you send an email.

Assistive technology can’t “see” the icon, so we should add an aria-label explaining what the button does. Important detail: we want a label on the interactive element, not on the icon, as that is what the user interacts with!

When the purpose of our button is communicated via our aria-label, we can hide the icon. Our web fonts and JavaScript software do this out of the box. If you use sprites or inline an SVG yourself, you should manually add an aria-hidden="true" to hide it from assistive technology.

<button type="submit" aria-label="Email us!">
<i class="fa-solid fa-envelope"></i>
</button>

If your icon is not part of an interactive element, but you would still like the icon to be announced by assistive technology such as screen readers, you can put an aria-label directly on the icon.

For web font icons, also add a role="img" so the icon is treated as an image, as aria-label officially isn’t supported on generic elements like an <i> or a <span>.

For SVG icons, make sure aria-hidden is removed or set to false so the icon is visible to assistive technology.

We <i class="fa-solid fa-heart" aria-label="love" role="img"></i> pizza!

Font Awesome comes bundled with basic animations in our support styling. These animations now support and leverage the prefers-reduced-motion CSS media feature to detect if a user has requested that the system minimize the amount of non-essential motion it uses.

CaseHow It Affects Included Animations
No preference set (default)Animations will render as expected
Preference set to reduceAnimations will be disabled

When a 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.

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 the 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 there are any bugs or issues.