# 类别无障碍性

**URL:** https://meta.discourse.org/t/a11y-for-categories/187696
**Category:** Support
**Tags:** accessibility
**Created:** [2021年四月22日 00:41 UTC](https://meta.discourse.org/t/a11y-for-categories/187696 "2021-04-22T00:41:24Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ivikash](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ivikash/32/212109_2.png) [@ivikash](https://meta.discourse.org/u/ivikash)
#### Post date: [2021年四月22日 00:41 UTC](https://meta.discourse.org/t/a11y-for-categories/187696/1 "2021-04-22T00:41:24Z")

</div>

大家好，

你们好吗？

我想了解一下如何为分类图片设置替代文本（alt text）和 ARIA 标签（aria-labels）？

此致  
~Vikash

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [2021年四月24日 01:24 UTC](https://meta.discourse.org/t/a11y-for-categories/187696/3 "2021-04-24T01:24:52Z")

</div>

目前无法为图片添加 aria-label，因此这些图片仅用于装饰用途，不宜用于其他目的。

按照当前的图片标记方式，屏幕阅读器似乎只会读出“graphic”而不再有其他内容。我们目前没有计划添加设置替代文本（alt text）的选项，但未来或许应在图片上传器中提供该功能。

在此期间，我们应在此处添加一个空的 `alt` 标签，使其被完全忽略，而不是保持当前这种无用的状态。

虽然可以通过主题组件中的[主题设置](https://meta.discourse.org/t/how-to-add-settings-to-your-discourse-theme/82557)为标记添加 aria-label，但如果您不熟悉 Discourse 主题的构建（[https://meta.discourse.org/t/developer-s-guide-to-discourse-themes/93648），这可能会比较困难。](https://meta.discourse.org/t/developer-s-guide-to-discourse-themes/93648%EF%BC%89%EF%BC%8C%E8%BF%99%E5%8F%AF%E8%83%BD%E4%BC%9A%E6%AF%94%E8%BE%83%E5%9B%B0%E9%9A%BE%E3%80%82)

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [2021年四月27日 01:25 UTC](https://meta.discourse.org/t/a11y-for-categories/187696/5 "2021-04-27T01:25:13Z")

</div>

我已合并空的 `alt` 标签修复

> <https://github.com/discourse/discourse/pull/12830>
>
> We don't have the ability to set \`alt\` or \`aria-\` tags on category logos, and un…til we do we should consider the logo decorative. Here I'm setting an empty \`alt\` tag so screen readers ignore them. When an \`alt\` tag isn't set some screen readers simply read "graphic" to the user, which is useless in this context!
> 
> Some discussion here: https://meta.discourse.org/t/a11y-for-categories/187696/3?u=awesomerobot

---

<div class="post-metadata">

### Author: ![ivikash](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ivikash/32/212109_2.png) [@ivikash](https://meta.discourse.org/u/ivikash)
#### Post date: [2021年四月27日 01:51 UTC](https://meta.discourse.org/t/a11y-for-categories/187696/6 "2021-04-27T01:51:01Z")

</div>

谢谢 Chris。我们可以使用图片标题作为替代文本吗？
