Iconography
Iconography aids communication, but should not take precedence over text
- Version:
- 0.1.0
- Status:
- Published
Introduction
Text is the primary form of communication on the web, and is highly interoperable. Only use icons where additional clarity is sought. Icons may help those with cognitive impairments, and others who find themselves on a page that isn't in their first language.
A comprehensive and standardized set of BBC icons is available. It is not recommended you create your own iconography. Cognition depends heavily on convention, and only by using established iconography can you foster familiarity.
Avoid icon fonts
The BBC icons are intended for implementation using inline SVG. Like icon fonts, SVG icons are infinitely scalable without degradation.
Unlike SVG, icon fonts icons are mapped to unicode points and interpreted as text. This can have accessibility issues. Most icon font sets map their icons to the unicode Private Use Areas in order to avoid overriding established, meaningful characters and symbols. A problem occurs when users set their own fonts, using an extension or user stylesheet: the icons are replaced with 'missing character' symbols[1]. Dyslexic users sometimes set their own fonts for improved legibility.
Icon font icons mapped to established characters are equally problematic. A close icon mapped to an 'A' would reveal itself as an 'A' when the font is overridden. Also, screen readers would interpret and announce the icon as 'A'.
Recommended markup
In all cases, icons should accompany either visible or visually hidden text label. The icon itself must take the focusable="false"
attribution to remove it from focus order (a default setting in some versions of Internet Explorer and Edge[2]). It should also take aria-hidden="true"
. Since the text label ("Delete" in the following example) is sufficient, identifying the SVG graphic is unnecessary. Do not provide alternative text / labels for icons where text is already available.
<button>
<svg class="gel-icon gel-icon--text" focusable="false" aria-hidden="true">
<use xlink:href="assets/svg/gel-icons-core-set.svg#gel-icon-download"></use>
</svg>
<span>Delete</span>
</button>
Only where icons are extremely well-established—such as the play and stop buttons of a media player—is it reliable to use them without supplementary visual text. In these cases, a visually hidden <span>
is recommended, since aria-label
encounters translation issues[3].
In these instances, hide the label's <span>
using the gel-sr
class or similar. This class obscures the text visually without silencing its announcement in screen readers.
.gel-sr {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
white-space: nowrap;
width: 1px;
}
Tooltips
If the icon has a tooltip, the tooltip can act as the primary label.
In the following example, the class="tooltip"
element provides the label.
<a href="link/to/download" download>
<svg class="gel-icon gel-icon--text" focusable="false" aria-hidden="true">
<use xlink:href="assets/svg/gel-icons-core-set.svg#gel-icon-download"></use>
</svg>
<span class="tooltip">Download</span>
</a>
By default, the tooltip would be hidden using display: none
. It would then be revealed on the :hover
and :focus
events.
[download] .tooltip {
display: none;
}
[download]:hover .tooltip,
[download]:focus .tooltip {
display: block;
}
Copyright © 2021 BBC. This content is published under the Open Government Licence, unless otherwise noted.