

























Posted on by Henny Swan in Design and development
Tags: Foundations, Assistive Technology, Code, WCAG
Text descriptions are primary content, and when images do not have a text description, anyone who cannot see the image will not know its purpose. This means people may be unable to access content or perform related tasks.
Appropriate text descriptions provide the following benefits:
The first step is to decide what type of image it is then what kind of text description it needs.
Ask yourself:
If your answer is "No, the image does not convey meaning", it is probably decorative and doesn't need a text description.
If your answer is "yes" in each case, then you may have one of the following types of image, all of which need text descriptions:
Decorative images are used to improve the visual appearance of the page. They don't convey any information or add to the user experience. Types of decorative images include:
Decorative images do not need text descriptions because they do not convey information or meaning. It is still important to handle decorative images in the right way though.
alt attribute on the <img> element but do not give it a value: alt="". If a different approach is used to generate images, for example an icon font), apply aria-hidden="true" to the element used for the image.android:contentDescription attribute on the image view, and set its value to @nullisAccessibilityElement property on the image to false and do not provide a labelAvoid images of text where possible because the visual quality of the text deteriorates for people browsing with screen magnification. If you have to use an image of text, the text description must contain the same words as the image itself.
Functional images form part of interactive elements like links or buttons. The text description for a functional image should convey the intended action of the interactive element. For example, a button to start a new email might show an icon of a pen, but the text description should be "New email", not "Pen icon" because it's the button's action that's the important information.
Informative images communicate information or add to the user experience in some way. Types of informative images include:
alt attribute on the <img> element to add the text descriptionandroid:contentDescription on the image view to add the text descriptionaccessibilityLabel attribute on the image to add the text descriptionComplex images convey detailed, factual information like graphs and charts, illustrations and infographics. The text description must be accompanied by a more extended description or an alternative presentation of the image.
alt attribute on the <img> element to add a short text description; then either:
aria-describedby attribute to point to an element on the same page that contains a longer description of the image<details> and <summary> elements (with the <img> element inside the <summary> element) to create a disclosure component that reveals the longer description on requestandroid:contentDescription on the image view to add a long text descriptionaccessibilityLabel attribute on the image to add a long text descriptionThink about how you would describe the image to someone on the phone. Here are some other things to think about:
<img> element or the properties of the image in native appsRead more accessibility foundations posts or sign up for Accessibility Unlocked, our free six-day newsletter series designed to help you kick-start accessibility.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。