このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docsコミュニティーについてもっと知り、仲間になるにはこちらから。
Element: ariaExpanded プロパティ
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.
ariaExpanded はElement インターフェイスのプロパティで、aria-expanded 属性の値を反映し、この要素が所有または制御するグループ化要素が展開されているか折りたたまれているかを示します。
In this article
値
以下のいずれかの値を持つ文字列です。
"true"この要素が所有または制御しているグループ化要素が展開されています。
"false"この要素が所有または制御しているグループ化要素が折り畳まれています。
"undefined"この要素は展開されているグループ化要素を所有または制御していません。
例
この例では、ID がanimal の要素のaria-expanded 属性は "false" に設定されています。ariaExpanded を使用して、値を "true" に更新します。
html
<div> <label for="animal">Animal</label> <input type="text" role="combobox" aria-autocomplete="list" aria-expanded="false" aria-haspopup="true" /> <button tabindex="-1" aria-label="Open">▽</button> <ul role="listbox" aria-label="Animals"> <li role="option">Cat</li> <li role="option">Dog</li> </ul></div>js
let el = document.getElementById("animal");console.log(el.ariaExpanded); // falseel.ariaExpanded = "true";console.log(el.ariaExpanded); // true仕様書
| Specification |
|---|
| Accessible Rich Internet Applications (WAI-ARIA)> # dom-ariamixin-ariaexpanded> |