A11y错误:链接没有可分辨的名称

时间:2018-11-19 04:25:20

标签: html accessibility

我有一个错误:

  

链接没有可分辨的名称链接文本(以及替代文本   图片(用作链接时)是可识别,唯一且可聚焦的   改善了屏幕阅读器用户的导航体验。学习   更多。

我试图添加一个aria标签,但是它不起作用。这会导致错误:

<a href="https://...../demo/index.php/Products/Description/Apple-Cinema-27/products_id-1" c="Apple Cinema 27">
  <img src="images/products/130_61ajN-dgGxL._SL1000_.jpg"
       alt="Apple Cinema 27"
       title="Apple Cinema 27"
       width="130"
       height="130"
       class="media-object img-fluid">
</a>

谢谢

2 个答案:

答案 0 :(得分:3)

也许alt属性只需要稍作修改。 alt属性应标识链接的目的地或目的。这是一个非常简化的示例:

    <a href="contact.html">
        <img src="contact.png" alt="Return to the contact page">
    </a>

因此,您可能不需要aria-label属性。

答案 1 :(得分:0)

尝试使用aria-label =“ ....”-这是图像的替代文字。

<a href="https://...../demo/index.php/Products/Description/Apple-Cinema-27/products_id-1" c="Apple Cinema 27" aria-label="yourdescription">