What is XHTML role attribute? What do you use it for?

后端 未结 3 1368
隐瞒了意图╮
隐瞒了意图╮ 2020-12-09 01:39

I have read W3C\'s page on this, but it is still vague to me. Is the role attribute\'s purpose to clarify the code? Or will it be interpreted by some browsers o

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-09 01:50

    The document you refer to is part of the work of the now discontinued XHTML 2 working group. It is effectively obsolete.

    HTML5/XHTML5 also has a role attribute. Its definition is similar but somewhat more limited - its purpose is to indicate Accessible Rich Internet Applications (ARIA) roles, so that assistive technology such as screen readers can better inform users about the purpose of UI components (widgets), and also help them navigate the web page more easily.

    The list of valid roles for ARIA is available at http://www.w3.org/TR/wai-aria/#roles

提交回复
热议问题