Small correction (or refinement) about icon names.
Name your icons based on what they are, not what they represent. For instance, a trash icon should be named trash, not delete. You can still add related keywords to improve discoverability.
Hmm. I pretty much disagree here. A standard "play" button icon should be called "play" not "triangle". Perhaps the checklist copy could be clearer about what is meant by naming? And what do I mean by naming?
I work primarily with accessibility, and have instructed our designers to make sure that all icons have an 'accessible name'. Our design system has a large collection of icons, and the Figma project associates each one with such a name. UI controls should always have accessible names, and if the control has an icon instead of a text label, the easiest way to do this is to name the icon itself.
We have gone so far as to hard-code these names into an aria-label
on the SVG assets themselves. (You need to add role="img"
as well for this trick to work). Here's an example, it's an icon used to label a button which clears an input field (circle with cross inside).
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Clear" height="24px" width="24px">
<g fill="currentColor"><path d="M8.795 8.794a1.005 1.005 0 0 1 1.421 0L12 10.578l1.784-1.783a1.005 1.005 0 1 1 1.422 1.421L13.422 12l1.784 1.784a1.005 1.005 0 0 1-1.422 1.421L12 13.422l-1.784 1.784a1.005 1.005 0 0 1-1.421-1.422L10.579 12l-1.784-1.784a1.005 1.005 0 0 1 0-1.422Z"></path>
<path d="M22 12c0-5.523-4.477-10-10-10S2 6.477 2 12s4.477 10 10 10 10-4.477 10-10Zm-2 0a8 8 0 1 1-16 0 8 8 0 0 1 16 0Z"></path>
</g>
</svg>`
If a dev uses those assets (e.g inside a <button>
), they get an accessible name "for free".
This is only a partial solution to the problem of naming icons accessibly. An icon may be used in an unconventional way, requiring a different name, or may be "purely decorative" (in which case, wrap it in a div or span with aria-hidden="true"
) International versions will need to change the attribute value too.
But having a default accessible name is almost always better than no accessible name at all.