Element: ariaReadOnly プロパティ

ariaReadOnlyElement インターフェイスのプロパティで、要素が編集不可であるが、それ以外は操作可能であることを示す aria-readonly (en-US) 属性の値を反映します。

メモ: 可能であれば、HTML の <input> 要素の type="text"<textarea> を使用してください。これらは意味づけがあり、ARIA 属性を必要としません。

以下のいずれかの値を持つ文字列です。

"true"

ユーザーは要素の値を変更できません。

"false"

ユーザーは要素の値を設定することができます。

この例では、ID が txtBoxInput の要素の aria-readonly 属性は "true" に設定されており、この入力は現在読み取り専用であることを示しています。ariaReadOnly を使用して、値を "false" に更新します。

html

<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>

js

let el = document.getElementById("txtBoxInput");
console.log(el.ariaReadOnly); // "true"
el.ariaReadOnly = "false";
console.log(el.ariaReadOnly); // "false"

仕様書

Specification
Accessible Rich Internet Applications (WAI-ARIA)
# dom-ariamixin-ariareadonly

ブラウザーの互換性

BCD tables only load in the browser

関連情報