h1 元素的有效角色属性值

Valid role attribute values for h1 element

(我已经检查过 this question,链接的属性对我不起作用。)

我有一个 h1 标签,其中包含一个可激活 onclick 的下拉菜单。 W3C 验证器在这里抱怨:

  <h1 class='dropdown-toggle' id='mylist' 
         data-toggle='dropdown'
         aria-haspopup='true'
         aria-expanded='true' 
         role='button'>

显然无法将 role='button' 分配给 h1。现在的问题是:我可以将哪个角色分配给 h1? W3C 的一长串角色属性并不能真正帮助找到解决方案。

Test page

如何找出 HTML5 元素可以具有哪些 WAI-ARIA 角色:

  1. 进入HTML5规范:http://www.w3.org/TR/2014/REC-html5-20141028/

  2. 检查 ToC 的第 4 部分以了解元素定义的 link:The h1, h2, h3, h4, h5, and h6 elements

  3. 检查该元素的“允许的 ARIA 角色属性值”:

    heading role (default - do not set), tab or presentation.

自从 HTML5 发布以来,2014 年 10 月,HTML 中的 ARIA 使用规则已移至 separate specification (a module of the HTML spec). The rules are still summarised in each element definition in the HTML spec。 在 h1-h6 elements 的情况下 rules are detailed (along with those of all other HTML elements) in the conformance table in ARIA in HTML.

Notes on using ARIA in HTML 也可能有助于理解 ARIA 在 HTML.

中使用的原因和方式