-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accessible font icons #52
Comments
Can I solve this @zwiastunsw |
@HarshCic : You don't need a permission to do it. We are happy to help you. Prepare and report PR |
I still dont agree with you that an icon needs to have a title for sighted users to understand the meaning of the icon. To me that just stinks of bad design if a sighted user cannot understand what the icon means from its shape and context |
Dozens of icons and even hundreds can be used as buttons. Do you really think that everyone will always understand them the same way? |
I think that there are icons which are so common use that we do not need a title attribute. |
It is difficult to discuss with convictions. You have the right to think this way. So let's agree that the WCAG requirements defined by the success criteria will simply be applied. |
We use icon fonts in many places. In this post I propose the consistent use of three patterns of embedding the font icons to ensure their accessibility.
There are basically two types of icon fonts:
Decorative icon
Decorative icons express the same meaning as the accompanying words. We use them to visually enhance the meaning of the illustrated words. If we remove them from the page, users will still fully understand the content and will be able to use the page. Such icons do not have to be announced to users of screen readers. We should hide them from screen readers.
To hide the icon font from screen readers, we use the
aria-hidden="true"
attribute. Add it to the tag with the icon font.For example:
Stand-alone icon
Stand-alone (semantic) icons convey meaning by themselves. They cannot be removed from the page without losing meaning or functionality. Since some users may not see the graphic symbols, we should pass their content in an alternative text. This is an elementary accessibility requirement specified in WCAG 2.1 by success criterion 1.1.1.
Stand-alone icons can be interactive elements, e.g. buttons, switches, links and "normal", non-interactive content elements.
Non-interactive icons
If the icon is not an interactive element:
aria-hidden="true"
attribute,title
attribute,sr-only
class.For example:
Interactive icons
If the icon is an interactive element:
aria-label="ActionName"
attribute.aria-hidden="true"
attribute.title
attribute,Note that in this case you do not have to create a hidden element with alternative text only for screen readers.
For example:
Note that the
title
attribute with label is added to the tag with the icon hidden from the screen readers, as opposed to thearia-label
attribute. As a result, screen readers do not repeat the label twice.Digression
In the discussion on PR Make ActionButton Featured accessible #23718 I withdrew from the suggestion to add a
title
attribute to provide an accessible name for sighted users.The PR author's argument that the meaning of the icon would be understandable from the context (column name) seemed convincing.
After thinking about it, I have to say that it was a wrong decision.
The
title
attribute is necessary (or any other way of providing alternative text for sighted users). Otherwise, the meaning of the icon may be incomprehensible to some users. No alternative text violates the Success Criterion 1.1.1 Non-text Content:Note: The problem can be solved using tooltips: https://codepen.io/dgrammatiko/pen/eGELjo
See:
About title attribute see:
The text was updated successfully, but these errors were encountered: