Element.ariaReadOnly is an instance property that reflects the aria-readonly attribute. Learn the true and false tokens, how read-only differs from disabled, and how to get or set the property from JavaScript—with five examples and try-it labs.
01
Kind
Instance property
02
Type
String
03
Values
true · false
04
Reflects
aria-readonly
05
Status
Baseline widely
06
Common with
role="textbox"
Fundamentals
Introduction
Sometimes a field should be visible and focusable, but users must not change its value—a locked form preview, a calculated total, or a confirmed address. That is read-only, not disabled.
aria-readonly carries that signal. ariaReadOnly is the JavaScript reflection of that attribute.
JavaScript
const el = document.getElementById("txtBoxInput");
console.log(el.ariaReadOnly); // "true"
el.ariaReadOnly = "false";
💡
Beginner tip (MDN)
Where possible, use an HTML <input type="text"> or a <textarea> with the native readonly attribute. Prefer ARIA read-only mainly for custom widgets (for example a role="textbox"). Keep real editing behavior in sync with the token.
Concept
Understanding the Property
MDN: the ariaReadOnly property of the Element interface reflects the value of the aria-readonly attribute, which indicates that the element is not editable, but is otherwise operable.
Reflected attribute — mirrors aria-readonly.
Get / set — readable and writable string.
Two tokens — true, false.
Baseline — widely available since October 2023 (MDN).
Foundation
📝 Syntax
JavaScript
ariaReadOnly
Value
A string with one of the following values:
Value
Meaning (MDN)
"true"
The user cannot change the value of the element.
"false"
The user can set the value of the element.
⚠️
Read-only vs disabled
Read-only: focusable and operable, but not editable. Disabled (see ariaDisabled): not operable. Pick the state that matches the real interaction.
Pattern
📋 MDN Example Shape
MDN starts with a contenteditable textbox marked aria-readonly="true", then unlocks it to "false":
JavaScript
<div id="txtboxMultilineLabel">Enter the tags for the article</div>
<div
role="textbox"
id="txtBoxInput"
contenteditable="true"
aria-multiline="true"
aria-labelledby="txtboxMultilineLabel"
aria-readonly="true"
></div>
JavaScript
let el = document.getElementById("txtBoxInput");
console.log(el.ariaReadOnly); // "true"
el.ariaReadOnly = "false";
console.log(el.ariaReadOnly); // "false"
When ariaReadOnly is "true", also block edits in script (or turn off contenteditable) so the real behavior matches what assistive technologies announce.
Cheat Sheet
⚡ Quick Reference
Goal
Code / note
Read
el.ariaReadOnly
Lock editing
el.ariaReadOnly = "true"
Allow editing
el.ariaReadOnly = "false"
Prefer when possible
<input readonly> / <textarea readonly>
Typical role
role="textbox"
MDN status
Baseline Widely available
Snapshot
🔍 At a Glance
Four facts about Element.ariaReadOnly.
Kind
get / set
Instance
Type
string
true / false
Reflects
aria-readonly
Attribute
Baseline
widely
Oct 2023+
Hands-On
Examples Gallery
Examples follow MDN Element: ariaReadOnly. Labs use a custom textbox so you can safely read and write the property.
📚 Getting Started
Read the reflected value and follow MDN’s update.
Example 1 — Read ariaReadOnly
Log whether a custom textbox is read-only.
JavaScript
const el = document.getElementById("txtBoxInput");
console.log(el.ariaReadOnly);
// HTML includes: role="textbox" aria-readonly="true"
Element.ariaReadOnly is Baseline Widely available (MDN: across browsers since October 2023). Logos use the shared browser-image-sprite.png sprite from this project.
✓ Baseline Widely available
Element.ariaReadOnly
String true / false — reflects aria-readonly for non-editable but operable widgets.
BaselineWidely available
Google ChromeSupported (ARIA reflection)
Yes
Microsoft EdgeSupported (ARIA reflection)
Yes
Mozilla FirefoxSupported (ARIA reflection)
Yes
Apple SafariSupported (ARIA reflection)
Yes
OperaFollow Chromium support
Yes
Internet ExplorerNo ariaReadOnly IDL — use setAttribute
No
ariaReadOnlyBaseline
Bottom line: Use ariaReadOnly on custom widgets to declare a non-editable but operable state. Prefer native readonly when you can. Keep real editing behavior in sync with the value.
Wrap Up
Conclusion
ariaReadOnly reflects aria-readonly so custom widgets can declare a non-editable but still operable state. Prefer native readonly when possible, and keep real editing behavior aligned with the announced token.
Keep the field focusable when it is only read-only
Update the property when lock / unlock modes switch
Test with keyboard and a screen reader
❌ Don’t
Confuse read-only with disabled
Announce read-only while still allowing edits
Skip native controls just to use ARIA
Leave custom textboxes without an accessible name
Assume the property alone blocks typing
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about ariaReadOnly
Reflected aria-readonly string for non-editable but operable widgets.
5
Core concepts
📄01
Get / set
on Element
Kind
📝02
true / false
locked vs editable
Values
🔍03
Prefer native
readonly attr
MDN
✅04
Baseline
widely available
Status
🎯05
Not disabled
still operable
Rule
❓ Frequently Asked Questions
It reflects the aria-readonly attribute as a string, indicating that the element is not editable but is otherwise operable.
No. MDN marks Element.ariaReadOnly as Baseline Widely available (since October 2023). It is not Deprecated, Experimental, or Non-standard.
The strings "true" (the user cannot change the value) or "false" (the user can set the value).
Yes when possible. MDN recommends an HTML input with type="text" or a textarea (with the readonly attribute) because they have built-in semantics and do not require ARIA attributes.
Read-only means the value cannot be changed, but the control can still be focused and operated (for example copied or scrolled). Disabled means the control is not operable.
Yes. Reading and writing ariaReadOnly updates the reflected aria-readonly attribute. Keep actual editing behavior in sync with the value.
Did you know?
Setting ariaReadOnly = "true" does not automatically stop typing in a contenteditable div. The attribute informs assistive technologies; your script (or native readonly) must enforce the lock.