HTML5复选框:哪个元素应该包含' aria-describedby' -attribute

时间:2015-02-20 15:06:19

标签: html5 twitter-bootstrap wai-aria

我目前在本地应用程序上为搜索页面编写用户界面。此搜索必须具有复选框以限制搜索查询的范围。为了使这个功能可以访问,我想使用" wai-aria" -Attributes。

到目前为止,我的标记看起来像这样:

<div class="input-group">
  <div class="checkbox-inline">
    <input type="checkbox" id="check-bd-1">
    <label for="check-bd-1">Band 1</label>
  </div>

  <div class="checkbox-inline">
    <input type="checkbox" id="check-bd-2"></input>
    <label for="check-bd-2">Band 2</label>
  </div>

  (... and so on...)

  <p id="help-check-band" class="form-control-static">Helptext...</p>
</div>

我想使用&#34; aria-describedby&#34; -Attribute引用帮助文本,由&#34; help-check-band&#34;标识。此文本适用于该组的每个输入。

我的问题是:我应该把&#34; aria-describedby&#34; -attribute?放在哪里?是否需要将它放在每个<input> - 元素上,或者将它放在最顶层div(使用类&#34;输入组&#34;)就足够了吗?

1 个答案:

答案 0 :(得分:0)

根据The Mozilla Dev-Network,两种方式似乎都是可能的。 &#34;咏叹调-describedby&#34;可以由容器和输入元件使用。由于input - 元素上的属性直接与功能相对应,因此这种方式似乎适合这种情况。