# 自定义徽章未应用替代文本

**URL:** https://meta.discourse.org/t/custom-badges-are-not-applying-alt-text/401648
**Category:** UX
**Tags:** badges, accessibility
**Created:** [2026 年4 月 27 日 19:44 UTC](https://meta.discourse.org/t/custom-badges-are-not-applying-alt-text/401648 "2026-04-27T19:44:56Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### 作者： ![wheinrich](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wheinrich/32/552485_2.png) [@wheinrich](https://meta.discourse.org/u/wheinrich)
#### 发布日期： [2026 年4 月 27 日 19:44 UTC](https://meta.discourse.org/t/custom-badges-are-not-applying-alt-text/401648/1 "2026-04-27T19:44:57Z")

</div>

当我使用 WAVE 扫描新 Discourse 网站的可访问性问题时，我注意到自定义徽章似乎没有加载任何替代文本（以下截图来自 Discourse 徽章，但问题本质相同）：

 ![image](https://global.discourse-cdn.com/meta/original/4X/5/9/f/59f521d68d196f9a0e6d3c8edb6f62f10baba076.png)

看起来它既没有提取文件名，也没有将徽章本身作为替代文本。

不确定我这边能做什么，或者是否需要由开发人员提交问题来解决。

谢谢！

---

<div class="post-metadata">

### 作者： ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### 发布日期： [2026 年5 月 5 日 15:39 UTC](https://meta.discourse.org/t/custom-badges-are-not-applying-alt-text/401648/2 "2026-05-05T15:39:47Z")

</div>

是的，感谢您报告这个问题——我们应在此处添加一个空的 alt 标签，因为徽章图片是装饰性的，再次添加徽章名称是多余的，因为它已经作为文本提供了。

将在以下位置完成：

> <https://github.com/discourse/discourse/pull/39755>
>
> When adding an image to custom badges like the one below, we don't add an alt ta…g to the image. We should add an empty alt tag, indicating that the image is only decorative. This is reasonable because the badge name is in accessible text next to the image, so the description of the image isn't necessary. 
> 
> \<img width="400" alt="image" src="https://github.com/user-attachments/assets/7920ddea-4c89-481c-8064-fa9d928e7991" /\>
> 
> This icon-or-image helper is used elsewhere, but they're all cases where this behavior is desired.

---

<div class="post-metadata">

### 作者： ![wheinrich](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wheinrich/32/552485_2.png) [@wheinrich](https://meta.discourse.org/u/wheinrich)
#### 发布日期： [2026 年5 月 5 日 15:52 UTC](https://meta.discourse.org/t/custom-badges-are-not-applying-alt-text/401648/3 "2026-05-05T15:52:35Z")

</div>

太棒了！非常感谢你们如此迅速的反馈！

---

<div class="post-metadata">

### 作者： ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### 发布日期： [2026 年5 月 21 日 13:58 UTC](https://meta.discourse.org/t/custom-badges-are-not-applying-alt-text/401648/4 "2026-05-21T13:58:51Z")

</div>


