About use 'aria-expanded' on 'role=menuitem'

本秂侑毒 提交于 2019-12-24 08:04:36

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/44990967/about-use-aria-expanded-on-role-menuitem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!