关于'role = menuitem'使用'aria-expanded' [英] About use 'aria-expanded' on 'role=menuitem'
问题描述
aria-expanded =bool
不支持属性
请参阅W3C HTML文档。 ( https://www.w3.org/TR/html/ )
如果使用它,请在 Nu Html Checker 上获取标记错误。但是当我创建一些菜单部件时,我必须使用它。而W3C在公式示例中使用相同的方式:
什么是正确的和错误的?
正如 ARIA文档所指出的那样
状态和属性相关概念,用于角色,继承到角色是咨询信息,但更重要的是:
使用给定的状态或属性是否t用于除列出的角色以外的角色。
因此,您完全有权使用 aria-expanded
在 role = menuitem
元素上,但只要它发出警告而不是错误,Nu验证器就是正确的。 / p>
编辑:HTML-ARIA文档还指定了3。允许的ARIA角色,州和属性是非规范性的:
下表提供了对ARIA角色的信息参考,允许在HTML中使用的状态和属性,所有ARIA角色,状态和属性都在ARIA 1.1规范中进行了规范定义
aria-expanded="bool"
is not support attribute that role="menuitem"
.
Please refer to W3C HTML Document. (https://www.w3.org/TR/html/)
If use that, get markup error on Nu Html Checker. But when I create some menu widget I must use it. And W3C use the same way in the formula example:
- https://www.w3.org/TR/2017/WD-wai-aria-practices-1.1-20170628/examples/menubar/menubar-1/menubar-1.html
- https://www.w3.org/WAI/tutorials/menus/application-menus-code/
What is right and what is wrong?
As pointed out by the ARIA documentation
State and properties "Related Concepts", "Used in Roles", "Inherits into Roles" are Advisory information, but more important :
Use of a given state or property is not defined when used on roles other than those listed.
So, you have perfectly the right to use the aria-expanded
on a role=menuitem
element but the "Nu validator" is right as long as it emits a warning, not an error.
EDIT: HTML-ARIA documentation also specifies that section "3. Allowed ARIA roles, states and properties" is non-normative:
The following table provides an informative reference to the ARIA roles, states and properties permitted for use in HTML. All ARIA roles, states and properties are normatively defined in the ARIA 1.1 specification.
这篇关于关于'role = menuitem'使用'aria-expanded'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!