What values can the HTML5/XHTML role attribute have?
Solution 1:
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
Solution 2:
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.