WAI-ARIA: Role=Code
A section whose content represents a fragment of computer code.
Description
A section whose content represents a fragment of computer code.
The primary purpose of the code role is to inform assistive technologies that the content is computer code and thus may require special presentation, in particular with respect to synthesized speech. More specifically, screen readers and other tools which provide text-to-speech presentation of content SHOULD prefer full punctuation verbosity to ensure common symbols (e.g. “-“) are spoken.
Characteristics
Superclass Role
Related Concepts
<code>
in [HTML]
Inherited States and Properties
- aria-atomic
- aria-busy (state)
- aria-controls
- aria-current (state)
- aria-describedby
- aria-details
- aria-disabled (state)
- aria-dropeffect
- aria-errormessage
- aria-flowto
- aria-grabbed (state)
- aria-haspopup
- aria-hidden (state)
- aria-invalid (state)
- aria-keyshortcuts
- aria-live
- aria-owns
- aria-relevant
- aria-roledescription
Prohibited States and Properties
Semantic HTML
The HTML alternative for role=”code” is the <code>
tag.
Reference
- WAI-ARIA 1.2 Specification
Refer to the notes from the WAI-ARIA 1.2 specification for more information on role=code.