Icon Fonts Verses SVG
I went down a rabbit hole for a little bit into the realm of icon fonts.
I personally feel that they solve a series of problems from a UX designer perspective, and was interested in the conversations around the strong opinions as to why they should be avoided.
To sum up the conclusion, as with any problem with implementing a user experience or accessibility solution, the answer indomitably is "it depends."
It all depends on how you're using them, who your users are, what your "product" is, and other technology you may have to accommodate to.
In the article "Seriously, Don't Use Icon Fonts" by Tyler Sticka, he lists some strong arguments against fonts, and for SVG's; such as:
- Font Icons may not display the correct icon, or display at all, depending on browser compatibility or if the user has selected to use a specific font such as OpenDyslexic
- Screen readers read out the font icon if it's not hidden
- They don't allow for multi-color or animated images
- It relies on unicode support to interpret them correctly and not get mixed with emojis
- Most won't go through the effort to provide fallback images in case font icons fail; or even if you do, it will be too hard to maintain
Example of unicode getting mixed up to replace the fifth star with a horse emoji on Etsy circ 2015 |
Since his article was written, there have been big advancements to some of the "broken font icon" issues he mentioned, and much more browser support.
In response to his article, Ben Frain wrote "Seriously, Use Font Icons" with a convincing list of reasons why you should use them, such as:
- They are better supported by Android 2.3 which has less support for SVG's
- They can scale and respond with any device-inherit text scaling settings
- You don't need multiple font formats
- They can have relatively robust visual styling applied with simple CSS
- Pages render faster with font icons
Some of the take aways that I was able to apply this to was:
If you're using icon fonts to enhance existing elements, use aria-hidden="true" to make sure screen readers don't read the icon name. This is relevant if your primary use of icon fonts are to add a pleasant visual to things like buttons or section headers to call out meaning with, but not rely solely on the image to understand the meaning. For example, a delete button can have a hidden trash can font icon because the text in the button is "delete."
If you need to ensure that there's an icon that displays, use an SVG. If your experience relies on the user being able to see the image reliably in order to complete their tasks, make sure that wont be a problem based on a font issue. This is most relevant to images that you'd need animation, multi colors, and if you are trying to accomodate to users who may use a different font than the one you've specified for the site.
If you have excessive issues with SVG sprite sheets not working correctly, icon fonts might be more appropriate. It can be frustrating to not have sprites appear the way they're intended, and can cause confusion for users if it overlaps with another icon. If the use of the icon is straightforward, and not crucial to the experience, icon fonts might be an appropriate direction to take until issues can be fixed.
If you're having problems with the font icons not looking aligned to text consistently, consider standardizing SVG's for any icon that needs to appear in a consistent way next to text. This would be relevant to varying icon images that may appear out of alignment to text due to the fact that some images are different proportions to horizontally or vertically aligned text. The hack to address this would be having a custom font size for the icon, than the standard text, but that complicates things unnecessarily.
While the articles I read and reference may be outdated at this point, they still bring up relevant points about use, intention, and use cases about what's appropriate, and when to find an alternative.