role attribute (html)
Screen Reader support level: supported
Voice Control support level: partial (7/14)
On this page
About this feature
The role attribute is used to convey the purpose of various elements to users of assistive technology. While the role attribute is defined in ARIA, these expectations test the attribute as implemented in HTML.
Age of results
Results across all tests for this feature range from 3 years ago to 5 years ago. Detailed dates and version information can be found in associated tests.
Caution
Failing or partial results may be out of date. The oldest result is from 5 years ago. Consider running the associated tests and contributing results.
Expectations
Screen Reader support by expectation
Expectation | JAWS | Narrator | NVDA | Orca | TalkBack | VoiceOver (iOS) | VoiceOver (macOS) | ||||
---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Edge | Chrome | Edge | Firefox | Firefox | Chrome | Safari | Safari | |
MUST convey the presence of the role attribute | supported | supported | supported | supported | supported | supported | supported | supported | supported | supported | supported |
MUST support fallback roles | supported | supported | supported | supported | supported | supported | supported | supported | supported | supported | supported |
SHOULD process changes in role values | supported | supported | supported | supported | supported | supported | supported | supported | supported | none | supported |
SHOULD NOT lose the location of the browsing caret when a container role is changed | supported | supported | supported | supported | supported | supported | supported | supported | supported | supported | supported |
Voice Control support by expectation
Expectation | Dragon Naturally Speaking | Voice Access (Android) | Voice Control (iOS) | Voice Control (MacOS) | Windows Speech Recognition | Windows Voice Access | ||
---|---|---|---|---|---|---|---|---|
Chrome | Chrome | Safari | Safari | Edge | Chrome | Edge | Chrome | |
MUST convey the presence of the role attribute | supported | supported | not applicable | supported | unknown | supported | unknown | unknown |
MUST support fallback roles | none | supported | not applicable | supported | unknown | supported | unknown | unknown |
SHOULD process changes in role values | supported | supported | not applicable | supported | unknown | supported | unknown | unknown |
MAY use the role to determine if an element is actionable | supported | supported | not applicable | supported | unknown | supported | unknown | unknown |
Expectation: convey the presence of the role attribute
Rationale:
The user needs to know when a role is defined.
Strength of this expectation for different types of assistive technologies:
- Screen Readers: MUST
- Voice Control: MUST
Notes:
The expectation is that a valid role value is conveyed to end users. This expectation does not check the correctness of the role conveyed, but only that a role is conveyed. Note that roles can be conveyed in a way that is implied by context and that AT have discretion in how to actually convey the role value. For example, some screen readers may convey the actual value of the role, and others may choose to convey a slightly different value. The correctness of role values is tested on a per-value bases elsewhere in this project.
Test | JAWS | Narrator | NVDA | Orca | TalkBack | VoiceOver (iOS) | VoiceOver (macOS) | ||||
---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Edge | Chrome | Edge | Firefox | Firefox | Chrome | Safari | Safari | |
HTML role attribute test suite applied to: div element | supported | supported | supported | supported | supported | supported | supported | supported | supported | supported | supported |
Test | Dragon Naturally Speaking | Voice Access (Android) | Voice Control (iOS) | Voice Control (MacOS) | Windows Speech Recognition | Windows Voice Access | ||
---|---|---|---|---|---|---|---|---|
Chrome | Chrome | Safari | Safari | Edge | Chrome | Edge | Chrome | |
HTML role attribute test suite applied to: div element | supported | supported | not applicable | supported | unknown | supported | unknown | unknown |
Expectation: support fallback roles
Rationale:
If multiple roles are defined, the user needs to be made aware of the first supported role value
Strength of this expectation for different types of assistive technologies:
- Screen Readers: MUST
- Voice Control: MUST
Notes:
Authors can list multiple role values within a role attribute, and each role is separated by white space. The first recognized role will be used used. This can be helpful when authors want to use a new role that is not widely supported yet, and fall back to an older role with wider support.
Test | JAWS | Narrator | NVDA | Orca | TalkBack | VoiceOver (iOS) | VoiceOver (macOS) | ||||
---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Edge | Chrome | Edge | Firefox | Firefox | Chrome | Safari | Safari | |
HTML role attribute test suite applied to: div element | supported | supported | supported | supported | supported | supported | supported | supported | supported | supported | supported |
Test | Dragon Naturally Speaking | Voice Access (Android) | Voice Control (iOS) | Voice Control (MacOS) | Windows Speech Recognition | Windows Voice Access | ||
---|---|---|---|---|---|---|---|---|
Chrome | Chrome | Safari | Safari | Edge | Chrome | Edge | Chrome | |
HTML role attribute test suite applied to: div element | none | supported | not applicable | supported | unknown | supported | unknown | unknown |
Expectation: process changes in role values
Rationale:
If the role of an element changes, users need to be able to determine the new role
Strength of this expectation for different types of assistive technologies:
- Screen Readers: SHOULD
- Voice Control: SHOULD
Notes:
Due to the way that accessibility APIs and caching mechanisms work, this may not be supported. ARIA explicitly forbids authors from changing roles in this way.
Test | JAWS | Narrator | NVDA | Orca | TalkBack | VoiceOver (iOS) | VoiceOver (macOS) | ||||
---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Edge | Chrome | Edge | Firefox | Firefox | Chrome | Safari | Safari | |
HTML role attribute test suite applied to: div element | supported | supported | supported | supported | supported | supported | supported | supported | supported | none | supported |
Test | Dragon Naturally Speaking | Voice Access (Android) | Voice Control (iOS) | Voice Control (MacOS) | Windows Speech Recognition | Windows Voice Access | ||
---|---|---|---|---|---|---|---|---|
Chrome | Chrome | Safari | Safari | Edge | Chrome | Edge | Chrome | |
HTML role attribute test suite applied to: div element | supported | supported | not applicable | supported | unknown | supported | unknown | unknown |
Expectation: lose the location of the browsing caret when a container role is changed
Rationale:
If a screen reader user is browsing the contents of a container element and the role of the container changes, the caret should stay in the same location so that the user can continue reading the document in a logical order.
Strength of this expectation for different types of assistive technologies:
- Screen Readers: SHOULD NOT
- Voice Control: NA
Notes:
When the role of an element changes, some AT and accessibility APIs may remove the element and all children and then replace them with the new container, which may result in the screen reader losing its caret position.
Test | JAWS | Narrator | NVDA | Orca | TalkBack | VoiceOver (iOS) | VoiceOver (macOS) | ||||
---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Edge | Chrome | Edge | Firefox | Firefox | Chrome | Safari | Safari | |
HTML role attribute test suite applied to: div element | supported | supported | supported | supported | supported | supported | supported | supported | supported | supported | supported |
Expectation: use the role to determine if an element is actionable
Rationale:
Voice control users may wish to activate roles that are actionable.
Strength of this expectation for different types of assistive technologies:
- Screen Readers: NA
- Voice Control: MAY
Notes:
Voice control software may choose to look at an element's role when determining if it is actionable. Some voice control software will allow users to activate elements by specific roles, while others will only flag actionable elements with numbers. Note that Voice Control for iOS will flag all elements on the page with numbers, not just those that are actionable.
Test | Dragon Naturally Speaking | Voice Access (Android) | Voice Control (iOS) | Voice Control (MacOS) | Windows Speech Recognition | Windows Voice Access | ||
---|---|---|---|---|---|---|---|---|
Chrome | Chrome | Safari | Safari | Edge | Chrome | Edge | Chrome | |
HTML role attribute tests for Voice Control applied to: div element | supported | supported | not applicable | supported | unknown | supported | unknown | unknown |