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

问题描述

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



请参阅W3C HTML文档。 ()



如果使用它,请在 Nu Html Checker 上获取标记错误。但是当我创建一些菜单部件时,我必须使用它。而W3C在公式示例中使用相同的方式:






什么是正确的和错误的?

解决方案

正如所指出的那样



状态和属性相关概念,用于角色,继承到角色是咨询信息,但更重要的是:

因此,您完全有权使用 aria-expanded 在 role = menuitem 元素上,但只要它发出警告而不是错误,Nu验证器就是正确的。 / p>

编辑:HTML-ARIA文档还指定了是非规范性的:


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 :

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:

这篇关于关于'role = menuitem'使用'aria-expanded'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 04:34