Aria roles are used to tell a screenreader what an element is for.
This is really important when the native HTML element just doesn't exist (eg. roles like toolbar
and alert
) or when you're using a different HTML element for design or technical reasons (eg. wrapping a radio
button to style it).
But please, remember that you should always use the semantic element where you can. This is always the best and most effective solution.
There are six different categories of aria roles:
button
, checkbox
, separator
, tab
, or scrollbar
combobox
and listbox
(these are for dropdown menus), radiogroup
, or tree
article
, presentation
, figure
, feed
, and directory
banner
, main
, navigation
, and region
are roles in this categoryalert
, log
, marquee
, and status
are roles that might update with real-time informationalertdialog
and dialog
are the only two roles in this categoryYou can check out the full list here: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques#roles