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.
ariaReadOnly は Element インターフェイスのプロパティで、要素が編集不可であるが、それ以外は操作可能であることを示す aria-readonly 属性の値を反映します。
メモ:
可能であれば、HTML の <input> 要素の type="text" と <textarea> を使用してください。これらは意味づけがあり、ARIA 属性を必要としません。
値
以下のいずれかの値を持つ文字列です。
例
この例では、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> |
ブラウザーの互換性
Loading…