A11y error: Links do not have a discernible name

ぐ巨炮叔叔 提交于 2019-12-23 04:52:43

问题


I have an error :

Links do not have a discernible name Link text (and alternate text for images, when used as links) that is discernible, unique, and focusable improves the navigation experience for screen reader users. Learn more.

I tried to include an aria-label but it doesn't work. This makes an error:

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

Thanks


回答1:


Perhaps the alt attribute just needs a slight modification. The alt attribute should identify the destination or purpose of the link. Here is a very simplified example:

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

You may not therefore need an aria-label attribute.




回答2:


Try use aria-label="...." - this is alternative text for image.

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



来源:https://stackoverflow.com/questions/53368300/a11y-error-links-do-not-have-a-discernible-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!