Element: ariaReadOnly-Eigenschaft
Baseline 2023Newly available
Since October 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Die ariaReadOnly
-Eigenschaft der Element
-Schnittstelle spiegelt den Wert des aria-readonly
-Attributs wider, welches anzeigt, dass das Element nicht bearbeitbar, aber anderweitig bedienbar ist.
Hinweis:
Verwenden Sie nach Möglichkeit ein HTML <input>
-Element mit type="text"
oder ein <textarea>
, da diese eingebaute Semantik besitzen und keine ARIA-Attribute erfordern.
Wert
Beispiele
In diesem Beispiel wird das aria-readonly
-Attribut des Elements mit der ID txtBoxInput
auf "true" gesetzt, was darauf hinweist, dass diese Eingabe derzeit nur lesbar ist. Mit ariaReadOnly
aktualisieren wir den Wert auf "false".
<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>
let el = document.getElementById("txtBoxInput");
console.log(el.ariaReadOnly); // "true"
el.ariaReadOnly = "false";
console.log(el.ariaReadOnly); // "false"
Spezifikationen
Specification |
---|
Accessible Rich Internet Applications (WAI-ARIA) # dom-ariamixin-ariareadonly |