为什么我的代码未通过Google无障碍审查?

时间:2019-04-15 15:14:58

标签: html accessibility html-form

基本上,我有一个输入和一个关联的标签,两者都具有相同的ID。但是,Google Accessibility Review失败了,响应如下:

  

表单元素没有关联的标签

对我来说,由于ID相同且标签指向输入,那么我看不到这里出了什么问题?

我遗漏了一些显而易见的东西吗??

<div class="field additional">

<label class="label" for="street_2">
<span>Address</span>
</label>

<div class="control">                                   
<input type="text" name="street[]" value="" title="Street Address 2" id="street_2" class="input-text " autocomplete="off" aria-required="true">
</div>

</div>

1 个答案:

答案 0 :(得分:0)

很多事情都可以解释这一点:

  • 您可能还有另一个标签linking to the same element与同一表单元素冲突,
  • 具有相同id
  • 元素可能会出现在同一HTML文档的其他位置,
  • 此消息可能与另一个表单元素有关,
  • 标签本身可能不可见

您的输入名称是一个数组(name="street[]")的事实让我认为,对于这些选择之一,我们并没有全部元素可以得出结论。