繁体   English   中英

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

[英]A11y error: Links do not have a discernible name

我有一个错误:

链接没有可辨别的名称 可辨别、独特且可聚焦的链接文本(以及图像的替代文本,当用作链接时)可改善屏幕阅读器用户的导航体验。 了解更多。

我试图包括一个咏叹调标签,但它不起作用。 这会导致错误:

<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>

谢谢

尝试使用 aria-label="...." - 这是图像的替代文本。

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

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

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM