简体   繁体   English

wcag 2.0 AA是否可以将标题和alt都保留为空并在隐藏的段落文本中添加文本?

[英]is it wcag 2.0 AA accessible to leave both title and alt empty and add the text in a hidden paragraph text?

Lets say the alt text of an image is too long and the image is linked as in below 可以说图片的替代文字太长,并且图片链接如下

 <a href="http://somelink.com" title=""> 
      <img src="someimage.png" alt=""/>
      <p class="hide_text">The complete alt text here as in too long to have any meaning to put in the title/alt above. Then is it accessible enough to put in the p tag?</p>
</a>

And I just hide the p text. 我只是隐藏p文本。 Is that WCAG 2.0 AA accessible compliant then? 那时WCAG 2.0 AA是否可访问? If both title and alt is empty in such case and I include the image alt text in the p... is that WCAG 2.0 AA accessible? 如果在这种情况下title和alt都为空,并且我在图像中包含了图像alt文本,那么是否可以访问WCAG 2.0 AA?

If an image is the only element inside an anchor tag, its alt text would need to describe the link's destination rather than the image itself. 如果图像是锚标记内的唯一元素,则其替代文本需要描述链接的目的地,而不是图像本身。 If this description is too long, then it may be worth asking yourself whether this is appropriate. 如果描述太长,那么可能值得问自己这是否合适。

This is a border-line WCAG pass/fail. 这是边界线WCAG通过/失败。 The image could be said to fail 1.1.1 (non-text content) because it's not decorative but has no alt text. 可以说该图像失败1.1.1(非文本内容),因为它不是装饰性的,但没有替代文本。 But the link itself would likely pass because the hidden text makes its destination programmatically determinable. 但是链接本身很可能会通过,因为隐藏的文本使其目标可以通过编程确定。

There's two reasons why I wouldn't use this approach: 为什么我不使用这种方法有两个原因:

  1. Hidden text might not be available to access technology on all devices. 隐藏的文本可能无法在所有设备上访问技术。 I've seen this happen using VoiceOver on the iPhone. 我已经看到使用iPhone上的VoiceOver会发生这种情况。

  2. Speech recognition users may have trouble clicking the link if seeing the image with no accompanying text doesn't give them enough info about how to instruct the recognition software to click the link. 如果看到没有附带文字的图像,语音识别用户可能无法单击链接,而该图像没有为他们提供有关如何指示识别软件单击链接的足够信息。

So in conclusion I'd use alt text, try to pare it down to a short description of the link's destination, and ensure that it's obvious from the image content how to click it using speech recognition. 因此,总之,我将使用替代文本,尝试将其缩减为链接目标的简短描述,并确保从图像内容中可以明显看出如何使用语音识别单击它。

The best option in my case I have found is to use something like below 就我而言,最好的选择是使用如下所示的内容

 <a href="http://somelink.com" title=""> 
      <img src="someimage.png" alt=" "/>
      <p class="hide_text">The complete alt text here as in too long to have any meaning to put in the title/alt above. Then is it accessible enough to put in the p tag?</p>
</a>

Put a space in the alt . 在alt中放一个空格。 So that when NVDA reads it, it is read as Link graphic link "The complete alt text here as in too long to have any meaning to put in the title/alt above. Then is it accessible enough to put in the p tag?" 因此,当NVDA读取它时,它被读为链接图形链接“此处的完整替代文本太长,以至于无法在上面的标题/替代中添加任何含义。那么,是否足以访问p标记?”

Seems to be ok. 似乎还可以。 I am just not 100% certain if I am violating any WCAG rules. 我不确定自己是否违反WCAG规则,只是100%不确定。

It is not WCAG AA compliant because if you put a title attribute on a A tag, it can't be empty. 它不符合WCAG AA,因为如果将title属性放在A标签上,则不能为空。

And I just hide the p text. 我只是隐藏p文本。

You can hide it as long as the screen-readers can read it (so no display: none )... 只要屏幕阅读器可以读取它,您就可以隐藏它(因此不display: none )...

It might be WCAG AA compliant from many people's view, but you have to remember that not all people use a speech synthetizer and that such invisible information should be made available for everybody. 从许多人的角度来看,它可能符合WCAG AA,但您必须记住,并非所有人都使用语音合成器,因此应该使所有人都可以使用这种不可见的信息。

Also, link text should be as short as possible. 另外,链接文本应尽可能短。

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

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