[英]Valid role attribute values for h1 element
(I already checked this question and the attributes linked do not work for me.) (我已经检查了这个问题 ,链接的属性对我不起作用。)
I have a h1
tag containing a dropdown which activates onclick. 我有一个包含下拉列表的h1
标签,可激活onclick。 The W3C Validator is complaining here: W3C Validator在这里抱怨:
<h1 class='dropdown-toggle' id='mylist'
data-toggle='dropdown'
aria-haspopup='true'
aria-expanded='true'
role='button'>
Apparently a role='button'
can't be assigned to h1
. 显然,无法将role='button'
分配给h1
。 Now the question is: which role can I assign to a h1
? 现在问题是:我可以将哪个角色分配给h1
? The W3C's long list of role attributes does not really help finding a solution. W3C的一长串角色属性并没有真正帮助找到解决方案。
How to find out which WAI-ARIA roles an HTML5 element can have: 如何找出HTML5元素可以具有的WAI-ARIA角色:
Go the HTML5 specification: http://www.w3.org/TR/2014/REC-html5-20141028/ 转到HTML5规范: http : //www.w3.org/TR/2014/REC-html5-20141028/
Check the ToC's section 4 for the link to the element's definition: The h1
, h2
, h3
, h4
, h5
, and h6
elements 检查ToC的第4部分,了解元素定义的链接: h1
, h2
, h3
, h4
, h5
和h6
元素
Check this element's "Allowed ARIA role attribute values": 检查此元素的“允许的ARIA角色属性值”:
heading
role (default - do not set),tab
orpresentation
.heading
角色(默认 - 不设置),tab
或presentation
。
Since HTML5 was published, in Oct 2014, the rules for use of ARIA in HTML have been moved into a separate specification (a module of the HTML spec). 自HTML5发布以来,2014年10月,HTML中使用ARIA的规则已经转移到单独的规范 (HTML规范的模块)中。 The rules are still summarised in each element definition in the HTML spec . 规范仍在HTML规范中的每个元素定义中进行了总结。 In the case of h1-h6 elements
the rules are detailed (along with those of all other HTML elements) in the conformance table in ARIA in HTML . 对于h1-h6 elements
, 规则 在HTML中的ARIA一致性表中 详细说明 (以及所有其他HTML元素的规则)。
Notes on using ARIA in HTML may also be helpful in understanding the why and how of ARIA use in HTML. 在HTML中使用ARIA的注意事项也可能有助于理解ARIA在HTML中使用的原因和方式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.