The HTML aria-readonly attribute
The aria-readonly="true" attribute marks a widget's value as not editable, while the widget can still be focused and read. Prefer the native readonly attribute on form fields. Values: true, false.
Overview
The aria-readonly attribute indicates that the value of a widget is not editable but is otherwise operable.
It is a widget property: a declaration about the widget that is normally set once, rather than a state that changes as the user interacts. Because ARIA does nothing on its own, keep it accurate and update it in JavaScript if the widget's behavior does change; a stale value is worse than none. And wherever a native element already expresses the same thing (a <textarea> for multi-line input, the required or readonly attribute, a native multiple select), use that instead.
Like all ARIA, aria-readonly changes only the accessibility tree (what assistive technology perceives), never the element's behavior or appearance. The first rule of ARIA applies: if a native HTML element or attribute conveys this, use that instead, and only reach for ARIA when nothing native fits.
Syntax
<div role="textbox" aria-readonly="true" tabindex="0" aria-label="Reference">Fixed value</div>
Values
| Value |
|---|
| true | false |
Example
<div role="combobox" aria-readonly="true" aria-expanded="false">Choose…</div>
Best practices
- Follow the first rule of ARIA: use a native HTML element or attribute that conveys this where one exists, rather than adding ARIA.
- Set it to match the behavior you actually implement, and change it only if that behavior changes.
- Use the matching native attribute where one exists (
required,readonly,multiple) instead of the ARIA version. - Set it only on an element whose role actually supports this property.