html - 具有 alt 属性但没有文本的 img 是否满足 WCAG 2.0 : Technique H30?

标签 html accessibility wai-aria wcag2.0

我正在阅读WCAG 2.0 Technique H30 .

程序说:

For each link in the content that uses this technique:

  1. Check that text or a text alternative for non-text content is included in the a element
  2. If an img element is the only content of the a element, check that its text alternative describes the purpose of the link
  3. If the a element contains one or more img element(s) and the text alternative of the img element(s) is empty, check that the text of the link describes the purpose of the link
  4. If the a element only contains text, check that the text describes the purpose of the link

我关注的是第 2 点:如果 img 具有 alt 属性,但没有替代文本怎么办?

例如,以下代码是否满足该技术要求?

<a href="http://www.mystite.com"> 
  <img src="http://www.mystite.com/myimage.jpg" alt="Description of the image" />
</a>

最佳答案

我想说你的例子不满足技术要求。

您的 a 元素仅包含一个 img 元素。根据 H30,该图像的 alt 属性应包含有关链接目标的信息,而不是有关图像本身的信息。

http://www.w3.org/TR/WCAG20-TECHS/H30.html#H30-description :

When an image is the only content of a link, the text alternative for the image describes the unique function of the link.

关于html - 具有 alt 属性但没有文本的 img 是否满足 WCAG 2.0 : Technique H30?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16712565/

相关文章:

html - 屏幕阅读器无法识别基本的 ARIA 地标角色

html - 防止在 iPhone 上垂直滚动

html - 仅向顶级元素添加样式

user-interface - 色盲的GUI设计

html - JAWS 不会读取角色为 ="tab"的 li 内链接中的 aria-label 链接

html - aria-label 是否会阻止辅助设备读取内部内容?

javascript - float 和非 float div 之间的 1px 边界

javascript - 两个功能不一起工作,而是独立工作

html - 让视障人士可以访问网站?

html - 像 aria-label 这样的 ARIA 属性应该可以在 HTML5 中翻译吗?