Element: ariaExpanded-Eigenschaft

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.

Die ariaExpanded-Eigenschaft des Element-Interfaces spiegelt den Wert des aria-expanded-Attributs wider, welches angibt, ob ein Gruppierungselement, das von diesem Element besessen oder kontrolliert wird, erweitert oder eingeklappt ist.

Wert

Ein String mit einem der folgenden Werte:

"true"

Das Gruppierungselement, das dieses Element besitzt oder kontrolliert, ist erweitert.

"false"

Das Gruppierungselement, das dieses Element besitzt oder kontrolliert, ist eingeklappt.

"undefined"

Das Element besitzt oder kontrolliert kein Gruppierungselement, das erweiterbar ist.

Beispiele

In diesem Beispiel wird das aria-expanded-Attribut beim Element mit der ID animal auf "false" gesetzt. Mit ariaExpanded aktualisieren wir den Wert auf "true".

html
<div class="animals-combobox">
  <label for="animal">Animal</label>
  <input
    id="animal"
    type="text"
    role="combobox"
    aria-autocomplete="list"
    aria-expanded="false"
    aria-haspopup="true" />
  <button id="animals-button" tabindex="-1" aria-label="Open"></button>
  <ul id="animals-listbox" role="listbox" aria-label="Animals">
    <li id="animal-cat" role="option">Cat</li>
    <li id="animal-dog" role="option">Dog</li>
  </ul>
</div>
js
let el = document.getElementById("animal");
console.log(el.ariaExpanded); // false
el.ariaExpanded = "true";
console.log(el.ariaExpanded); // true

Spezifikationen

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

Browser-Kompatibilität

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
ariaExpanded

Legend

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

Full support
Full support