关于'role = menuitem'使用'aria-expanded' [英] About use 'aria-expanded' on 'role=menuitem'

查看:1074
本文介绍了关于'role = menuitem'使用'aria-expanded'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

aria-expanded =bool不支持属性 role =menuitem。



请参阅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:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆