Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What values can the HTML5/XHTML role attribute have?

Tags:

html

I was wondering what values are valid in the HTML5/XHTML role attribute?

like image 641
HELP Avatar asked Nov 13 '10 01:11

HELP


People also ask

What is the role attribute in html5?

The role attribute describes the role of an element in programs that can make use of it, such as screen readers or magnifiers. Screen Readers will read this element as “button” instead of “link”.

What is an attribute role in XML?

The attribute describes the role(s) the current element plays in the context of the document. This can be used, for example, by applications and assistive technologies to determine the purpose of an element.

What are ARIA roles?

The definition ARIA role indicates the element is a definition of a term or concept. The dialog role is used to mark up an HTML based application dialog or window that separates content or UI from the rest of the web application or page.


2 Answers

Here are the valid roles based on HTML 5.2...

  • alert
  • alertdialog
  • application
  • article
  • banner
  • button
  • cell
  • checkbox
  • columnheader
  • combobox
  • complementary
  • contentinfo
  • definition
  • dialog
  • directory
  • document
  • feed
  • figure
  • form
  • grid
  • gridcell
  • group
  • heading
  • img
  • link
  • list
  • listbox
  • listitem
  • log
  • main
  • marquee
  • math
  • menu
  • menubar
  • menuitem
  • menuitemcheckbox
  • menuitemradio
  • navigation
  • none
  • note
  • option
  • presentation
  • progressbar
  • radio
  • radiogroup
  • region
  • row
  • rowgroup
  • rowheader
  • scrollbar
  • search
  • searchbox
  • separator
  • slider
  • spinbutton
  • status
  • switch
  • tab
  • table
  • tablist
  • tabpanel
  • term
  • textbox
  • timer
  • toolbar
  • tooltip
  • tree
  • treegrid
  • treeitem
like image 77
Zim Avatar answered Sep 28 '22 17:09

Zim


It appears that in HTML5, the contents of the role attribute is specified as a WIA-ARIA attribute. See, specifically, the last paragraph of section 3.2.3 "Global attributes", where it states:

To enable assistive technology products to expose a more fine-grained interface than is otherwise possible with HTML elements and attributes, a set of annotations for assistive technology products can be specified (the ARIA role and aria-* attributes).

The role attribute is, then, further detailed in section 3.2.7 "WAI-ARIA", and provides an apparently normative table of semantics and values for the attribute on an element-by-element basis.

Note: The links to specific sections of the HTML5 specification above point to the "latest published version" of the HTML5 Technical Report at http://www.w3.org/TR/html5/. A more current "editor's draft" version might be available. The TR will link to it on the title page of the document. As the specification is updated or transitions to a new phase of adoption, these links might break and will need to be updated.

like image 33
RobertB Avatar answered Sep 28 '22 17:09

RobertB