[role] attribute must be appropriate for the element

Roles provided by ARIA provide semantic meaning to content and enable tools like screen readers to present and support objects in ways that are consistent with expectations of the types of objects presented. It is possible to use ARIA roles to describe elements that are not natively supported by HTML or supported but not fully. Semantic elements have roles by default; *p> has the "paragraph" role, and <input type="radio"> has the "radio" role. The non-semantic elements are not assigned roles; <div> and *span> without semantics are null. Semantic information can be obtained from the role attribute.

ARIA roles are HTML attributes. Element roles are added using the role="role type" attribute, where role type is the role's name in the ARIA specification. ARIA states and properties are required for some roles, but others work only in combination with other roles.

As an example, screen readers will identify <ul role="tabpanel"> as a 'tab panel'. Tab panels that do not support nested tabs are not tab panels, which means accessibility is negatively impacted.

Fixing the problem

Role="" values need to correspond to the following WAI-ARIA roles:

  • Landmark: article, banner, complementary, main, navigation, region, search, contentinfo
  • Widget: alert, alertdialog, application, dialog, group, log, marquee, menu, menubar, menuitem, menuitemcheckbox, menuitemradio, progressbar, separator, slider, spinbutton, status, tab, tablist, tabpanel, timer, toolbar, tooltip, tree, treegrid, treeitem
  • Pseudo HTML: button, button, checkbox, columnheader, combobox, form, grid, gridcell, heading, img, link, listbox, listitem, option, radio, radiogroup, row, rowgroup, rowheader, scrollbar, textbox
  • Document: document (when creating a document region inside an other type of region)
  • Application: application (only around a widget to enable normal keyboard shortcuts for page content)
  • Presentation: presentation (to cancel the native role of the element)
  • Other Semantic: math, definition, note, directory
  • Abstract: command, composite, input, landmark, range, section, sectionhead, select, structure, widget