|  | 
| 1 | 1 | --- | 
| 2 | 2 | title: Alternative text | 
| 3 |  | -description: Shopify aims to provide an [inclusive experience](/foundations/accessibility). Alternative text (alt text) helps people with low or loss of vision use our products. | 
|  | 3 | +description: Alternative text (alt text) helps provide an inclusive experience for merchants who use screen readers. | 
| 4 | 4 | icon: ImageAltMajor | 
| 5 | 5 | keywords: | 
| 6 | 6 |   - speech synthesis | 
| @@ -34,126 +34,224 @@ keywords: | 
| 34 | 34 |   - alt text | 
| 35 | 35 |   - accessibility feedback | 
| 36 | 36 |   - accessible components | 
|  | 37 | +  - blind | 
| 37 | 38 | --- | 
| 38 | 39 | 
 | 
| 39 |  | -Generally, alt text is text replacement for an image and is often represented by the alt HTML element attribute, `alt=""`, but is also used in other scenarios. | 
|  | 40 | +Alt text is a text replacement for an image. Generally, it is represented by the alt HTML element attribute `alt="alt text"`. | 
| 40 | 41 | 
 | 
| 41 |  | -Screen readers announce alt text to explain images to people with low or loss of vision. Alt text is also displayed if images fail to download for some reason (for example, due to an unstable network connection). | 
|  | 42 | +Often used by people with low or loss of vision, screen readers announce alt text to explain images. Alt text also displays if images fail to download (for example, there’s an unstable or low-bandwidth network connection). | 
| 42 | 43 | 
 | 
| 43 | 44 | Alt text should: | 
| 44 | 45 | 
 | 
| 45 | 46 | - Help visitors navigate the site | 
| 46 | 47 | - Provide an inclusive experience | 
| 47 |  | -- Be as specific and concise as possible | 
|  | 48 | +- Be as short and specific as possible | 
|  | 49 | +- Be contextual to the intended message | 
| 48 | 50 | 
 | 
| 49 | 51 | --- | 
| 50 | 52 | 
 | 
| 51 | 53 | ## Alt text for images | 
| 52 | 54 | 
 | 
| 53 |  | -All `<img>` tags need an alt text attribute, even if it’s empty. We need to let the screen reader know to ignore the image. | 
|  | 55 | +Use alt text when the image conveys valuable information, such as the ability to play a demo video. Even if an image isn’t conveying meaningful information, don’t leave an `<img>` tag without an alt text element. The screen reader may try to read the filename and create a negative experience. Instead, let the screen reader know to ignore the image by setting the alt to an empty string. | 
| 54 | 56 | 
 | 
| 55 |  | -Empty alt text attribute for images: `<img alt="" />` | 
|  | 57 | +All `<img>` tags need an alt text attribute, even if it’s empty. For example, set an empty alt text attribute using `<img alt="" />`. | 
| 56 | 58 | 
 | 
| 57 | 59 | <!-- dodont --> | 
| 58 | 60 | 
 | 
| 59 | 61 | #### Do | 
| 60 | 62 | 
 | 
| 61 |  | -Use alt text when the image conveys valuable information, such as the ability to play a demonstration video. | 
|  | 63 | +```jsx | 
|  | 64 | +<VideoThumbnail accessibilityLabel="Watch how-to video on Shopify reports." /> | 
| 62 | 65 | 
 | 
| 63 |  | -In this case, you would use: | 
| 64 |  | -`<img alt="Watch a video on how the Shopify reports section works." />` | 
|  | 66 | +<Thumbnail alt="Black choker necklace" /> | 
|  | 67 | + | 
|  | 68 | +<Icon accessibilityLabel="" /> | 
|  | 69 | +``` | 
| 65 | 70 | 
 | 
| 66 | 71 | #### Don’t | 
| 67 | 72 | 
 | 
| 68 |  | -Use alt text when the image doesn’t add clarity to the task. In this case, leave the alt text attribute empty: `alt=""` | 
|  | 73 | +```jsx | 
|  | 74 | +<VideoThumbnail accessibilityLabel="Screenshot 2022-11-07 at 3.05.55 PM" /> | 
|  | 75 | + | 
|  | 76 | +<Thumbnail alt="Sneaker.png" /> | 
|  | 77 | + | 
|  | 78 | +<Icon accessibilityLabel="IMG_1206.heic" /> | 
|  | 79 | +``` | 
| 69 | 80 | 
 | 
| 70 | 81 | <!-- end --> | 
| 71 | 82 | 
 | 
| 72 | 83 | --- | 
| 73 | 84 | 
 | 
| 74 | 85 | ## Writing alt text | 
| 75 | 86 | 
 | 
| 76 |  | -Alt text should always be written in plain text. | 
|  | 87 | +Always write alt text in plain text. The average rate of listening to a screen reader is 3x slower than that of an average visual reader. Many screen reader users listen at fast speeds to make up time. When writing alt text, be as brief as possible. | 
| 77 | 88 | 
 | 
| 78 |  | -- Use the simplest words you can. Stuck on how to replace a complicated word? Check this [A-Z list of alternative words](https://www.plainenglish.co.uk/the-a-z-of-alternative-words.html) or these [plain language tips](/content/product-content#write-for-a-7-grade-reading-level). | 
| 79 |  | -- Avoid needless words. If you take out a word, is the phrase just as easy to understand? If yes, then cut that word. | 
| 80 |  | -- Write concisely. Thinking about how to write for a small amount of space is a good shortcut. | 
| 81 |  | -- Write in the [active voice](/content/grammar-and-mechanics#basics). Only use the passive voice if you want to hide who is doing the thing described. | 
|  | 89 | +- Be concise. Think about how to write for a small amount of space or a character limit. | 
|  | 90 | +- Use simple words. If you’re stuck on how to replace a complicated word, check this [A-Z list of alternative words](https://www.plainenglish.co.uk/the-a-z-of-alternative-words.html) or these [plain language tips](/content/product-content#write-for-a-7-grade-reading-level). Another good resource is the [Hemingway editor](https://hemingwayapp.com/). | 
|  | 91 | +- Avoid needless words. If a phrase is still understandable without a specific word, remove it. | 
|  | 92 | +- Remove articles like "a, an, one of," etc. whenever possible. Alt text has different grammatical rules. "Filler words" that assist understanding in speech can get in the way in alt text. | 
|  | 93 | +- Avoid using "image of" or "photograph" unless the type of image is relevant to the context. Screenreaders already announce images with use of the `<img>` attribute. | 
|  | 94 | +- Avoid punctuation like `!!` and emoji like 🥰. Screen readers will announce these as "exclamation point, exclamation point" and "smiling face with three hearts." | 
|  | 95 | +- Only use acronyms you are confident your audience will understand. If using an acronym, write it with spaces in-between, like "Y M C A." Otherwise, most screen readers will try to read the acronym as a word. | 
|  | 96 | +- Write in the [active voice](/content/grammar-and-mechanics#basics) when possible. | 
| 82 | 97 | 
 | 
| 83 | 98 | --- | 
| 84 | 99 | 
 | 
| 85 |  | -## Situations that need alt text | 
|  | 100 | +## Alt text in context | 
| 86 | 101 | 
 | 
| 87 |  | -### Icons | 
|  | 102 | +It can be tricky to decide whether an image needs alt text or should be ignored by screen readers. Ask yourself: | 
| 88 | 103 | 
 | 
| 89 |  | -[Icons](/components/images-and-icons/icon) that could be misinterpreted need an explanation, so use the `aria-label` attribute. | 
|  | 104 | +- Is it interactive? | 
|  | 105 | +- Does this image convey information that isn’t given elsewhere? | 
|  | 106 | +- Does the context of the image communicate anything? | 
| 90 | 107 | 
 | 
| 91 |  | -```html | 
| 92 |  | -<button aria-label="Close" onclick="myDialog.close()">X</button> | 
|  | 108 | +The same image may have different alt text depending on what it conveys. | 
|  | 109 | + | 
|  | 110 | +For example, if you’re using a photo of sneakers purely decoratively as the hero image for a blog, tell screen readers to skip it. | 
|  | 111 | + | 
|  | 112 | +If you’re using the photo as an example of a certain type of sneaker mentioned in the blog, then convey relevant information about the image. For example, "High-top sneaker with gum soles." | 
|  | 113 | + | 
|  | 114 | +But if you’re using this image in a product listing, ensure shoppers know the important details of what they are buying, such as "Converse Chuck Taylor All Star Classic Black." | 
|  | 115 | + | 
|  | 116 | +### Situations that need alt text | 
|  | 117 | + | 
|  | 118 | +#### Icons | 
|  | 119 | + | 
|  | 120 | +[Icons](/components/images-and-icons/icon) that could be misinterpreted need an explanation, so use the Polaris `accessibilityLabel` prop or the `aria-label` HTML attribute. For interactive icons, don’t describe the image ("magnifying glass"). Instead, describe the action ("search"). | 
|  | 121 | + | 
|  | 122 | +```jsx | 
|  | 123 | +<Button accessibilityLabel="search" onClick={() => search()}> | 
|  | 124 | +  <Icon source={SearchMajor} accessibilityLabel="" /> | 
|  | 125 | +</Button> | 
| 93 | 126 | ``` | 
| 94 | 127 | 
 | 
| 95 |  | -### Actions | 
|  | 128 | +#### Actions | 
| 96 | 129 | 
 | 
| 97 |  | -If space constraints require you to write calls to action without nouns, like “learn more” and “apply now”, give further indication of where merchants will be sent after they select. | 
|  | 130 | +Write [clear and predictable](https://polaris.shopify.com/content/actionable-language#links) link text. If space constraints require you to write calls to action that are unclear where they take you (like "Learn more" and "Apply now"), give further indication of where merchants will be sent after they select. | 
| 98 | 131 | 
 | 
| 99 |  | -```html | 
| 100 |  | -<a | 
| 101 |  | -  href="{cta-url}" | 
| 102 |  | -  aria-label="Learn more about opening an online store with Shopify" | 
| 103 |  | -  >Learn more</a | 
|  | 132 | +```jsx | 
|  | 133 | +<Link | 
|  | 134 | +  url="https://www.shopify.com/protect" | 
|  | 135 | +  accessibilityLabel="Learn more about Fraud Protect" | 
| 104 | 136 | > | 
|  | 137 | +  Learn more | 
|  | 138 | +</Link> | 
| 105 | 139 | ``` | 
| 106 | 140 | 
 | 
| 107 |  | -### Complex images | 
|  | 141 | +#### Complex images | 
| 108 | 142 | 
 | 
| 109 |  | -Images with a bit more complexity need more logic in the code. | 
|  | 143 | +Images with more complexity need some consideration. For example, groups of image elements can be described by a single text, rather than announcing each individual element. | 
| 110 | 144 | 
 | 
| 111 |  | -```html | 
|  | 145 | +```jsx | 
| 112 | 146 | <div role="img" aria-labelledby="star_id"> | 
| 113 |  | -  <img src="fullstar.png" alt="" /> | 
| 114 |  | -  <img src="fullstar.png" alt="" /> | 
| 115 |  | -  <img src="halfemptystar.png" alt="" /> | 
|  | 147 | +  <Stack> | 
|  | 148 | +    <Icon source={StarFilledMinor} alt=""> | 
|  | 149 | +    <Icon source={StarFilledMinor} alt=""> | 
|  | 150 | +    <Icon source={StarFilledMinor} alt=""> | 
|  | 151 | +    <Icon source={StarOutlineMinor} alt=""> | 
|  | 152 | +    <Icon source={StarOutlineMinor} alt=""> | 
|  | 153 | +  </Stack> | 
| 116 | 154 | </div> | 
| 117 | 155 | <div id="star_id">3 of 5 stars</div> | 
| 118 | 156 | ``` | 
| 119 | 157 | 
 | 
|  | 158 | +For more guidance, visit the W3C page on [complex images](https://www.w3.org/WAI/tutorials/images/complex/). | 
|  | 159 | + | 
|  | 160 | +### Situations that don’t need alt text | 
|  | 161 | + | 
|  | 162 | +Websites can sometimes be noisy for a screen reader user. While alt text is vital for an equal experience, the briefer you are, the happier your screen reader users will be. Avoid repetition and unnecessary announcements by setting `alt=""` in the scenarios that don’t need it. | 
|  | 163 | + | 
|  | 164 | +#### Progress bars | 
|  | 165 | + | 
|  | 166 | +Progress bars often present visual information that can also be found in the text, such as "Loading 53%." Continuously announcing that change is generally considered annoying. | 
|  | 167 | + | 
|  | 168 | +#### Decorative elements | 
|  | 169 | + | 
|  | 170 | +This is a broad category covering elements that are purely for aesthetic reasons, such as empty state illustrations, dividers, or hero images. If you’re unsure whether valuable information is lost, consider testing with people who regularly use a screen reader. | 
|  | 171 | + | 
|  | 172 | +#### Images with adequate captions | 
|  | 173 | + | 
|  | 174 | +Avoid adding repetitive alt text if an image has a caption that accurately reflects the information in the image, for example a photo of George Washington that is captioned "George Washington." If the image is presenting information that isn’t in the caption, consider adding it to the caption text. Only if this isn’t possible or appropriate should you add that information as alt text. | 
|  | 175 | + | 
|  | 176 | +If the image has a longer description in the caption or following paragraph text, you can associate this description with the `aria-describedby` attribute. | 
|  | 177 | + | 
|  | 178 | +#### Tracking images | 
|  | 179 | + | 
|  | 180 | +Images that would not be visible to a sighted user should not be announced to screen-readers. | 
|  | 181 | + | 
| 120 | 182 | --- | 
| 121 | 183 | 
 | 
| 122 | 184 | ## Pronunciation and translation | 
| 123 | 185 | 
 | 
| 124 |  | -Not only are we striving to make interactions with our products pleasurable, we also want to try to make the listening experience for our merchants pleasant as well. The HTML lang attribute helps speech synthesis tools figure out pronunciation and translation tools figure out what rules to use. | 
|  | 186 | +Not only do we strive to make interactions with our products pleasant, but we want the listening experience for merchants to be positive, too. Always state the language of the page content with the HTML lang attribute. This will ensure pronunciation and translation tools will know what rules to use. If certain phrases are in a different language than the main content, you can also use the lang attribute in a `<p>` tag or similar. | 
|  | 187 | + | 
|  | 188 | +Here’s a | 
|  | 189 | +[standard list of language attributes](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry) that you can use in your document. | 
| 125 | 190 | 
 | 
| 126 | 191 | <!-- dodont --> | 
| 127 | 192 | 
 | 
| 128 | 193 | #### Do | 
| 129 | 194 | 
 | 
| 130 |  | -Indicate the language of the page. This example is for English. | 
| 131 |  | - | 
| 132 | 195 | ```html | 
| 133 | 196 | <html lang="en"></html> | 
|  | 197 | +<html lang="de"></html> | 
|  | 198 | +<html lang="pt-BR"></html> | 
| 134 | 199 | ``` | 
| 135 | 200 | 
 | 
| 136 | 201 | #### Don’t | 
| 137 | 202 | 
 | 
| 138 |  | -Fail to indicate the language of the page. | 
| 139 |  | - | 
| 140 | 203 | ```html | 
| 141 | 204 | <html></html> | 
| 142 | 205 | ``` | 
| 143 | 206 | 
 | 
| 144 | 207 | <!-- end --> | 
| 145 | 208 | 
 | 
| 146 |  | -Here’s a | 
| 147 |  | -[standard list of language attributes](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry) that you can use in your document. | 
| 148 |  | - | 
| 149 | 209 | --- | 
| 150 | 210 | 
 | 
| 151 | 211 | ## SEO | 
| 152 | 212 | 
 | 
| 153 |  | -Alt text is a good way to increase site searchability. This applies outside of Shopify’s admin. | 
|  | 213 | +Besides screen readers, search engines also read alt text. Alt text helps increase image ranking results and site searchability outside of Shopify’s admin. | 
|  | 214 | + | 
|  | 215 | +When accounting for SEO in your alt text: | 
|  | 216 | + | 
|  | 217 | +- Use logical keywords (the words that people search for). | 
|  | 218 | +- Include relevant listing details, like if it is a limited edition or unique colorway. | 
|  | 219 | +- Describe the image, not what you want your audience to think. | 
|  | 220 | +- Don’t repeat your site name or brand name. Search engines will already associate your site with your images. | 
|  | 221 | +- Avoid reducing the relevance or clarity of the alt text just to insert a keyword. | 
|  | 222 | +- Never include unassociated lists of key words in the alt text. Instead, place those in your [meta description](https://help.shopify.com/en/manual/promoting-marketing/seo/adding-keywords#edit-the-title-and-meta-description-for-a-page). | 
|  | 223 | + | 
|  | 224 | +<!-- dodont --> | 
|  | 225 | + | 
|  | 226 | +#### Do | 
|  | 227 | + | 
|  | 228 | +```jsx | 
|  | 229 | +<Thumbnail alt="1460 Boot Limited Edition Oxblood Women's" /> | 
|  | 230 | +``` | 
|  | 231 | + | 
|  | 232 | +#### Don’t | 
|  | 233 | + | 
|  | 234 | +```jsx | 
|  | 235 | +<Thumbnail alt="shoes sneakers womens footwear girls sizes soles heels boots" /> | 
|  | 236 | + | 
|  | 237 | +<Thumbnail alt="Cool shoes for a night out or hot date" /> | 
|  | 238 | +``` | 
|  | 239 | + | 
|  | 240 | +<!-- end --> | 
|  | 241 | + | 
|  | 242 | +## Resources | 
|  | 243 | + | 
|  | 244 | +For more information on coding and alt text standards, visit the | 
|  | 245 | +[Web Content Accessibility Guidelines (WCAG)](https://www.w3.org/WAI/intro/wcag.php) or [WebAIM Alternative Text Guidelines](https://webaim.org/techniques/alttext/). | 
|  | 246 | + | 
|  | 247 | +## Related components | 
| 154 | 248 | 
 | 
| 155 |  | -- Use keywords (the words that people search for) logically | 
| 156 |  | -- Never reduce the relevance or clarity of the alt text just to insert a keyword | 
|  | 249 | +The following Polaris components come props to set alt text or aria labels, along with specific guidance for their use: | 
| 157 | 250 | 
 | 
| 158 |  | -For a deeper dive into coding and alt text standards, visit the | 
| 159 |  | -[Web Content Accessibility Guidelines (WCAG)](https://www.w3.org/WAI/intro/wcag.php). | 
|  | 251 | +- [Avatar](https://polaris.shopify.com/components/images-and-icons/avatar) | 
|  | 252 | +- [Button](/components/actions/button) | 
|  | 253 | +- [Icon](/components/images-and-icons/icon) | 
|  | 254 | +- [Image](/components/images-and-icons/image) | 
|  | 255 | +- [Link](https://polaris.shopify.com/components/navigation/link) | 
|  | 256 | +- [Thumbnail](https://polaris.shopify.com/components/images-and-icons/thumbnail) | 
|  | 257 | +- [Video Thumbnail](https://polaris.shopify.com/components/images-and-icons/video-thumbnail) | 
0 commit comments