Element: ariaReadOnly プロパティ

Baseline 2023
Newly available

Since October 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

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

メモ: 可能であれば、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

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
ariaReadOnly

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

関連情報