1. 開発者向けのウェブ技術
  2. Web API
  3. Element
  4. ariaExpanded

このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

Element: ariaExpanded プロパティ

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.

ariaExpandedElement インターフェイスのプロパティで、aria-expanded 属性の値を反映し、この要素が所有または制御するグループ化要素が展開されているか折りたたまれているかを示します。

以下のいずれかの値を持つ文字列です。

"true"

この要素が所有または制御しているグループ化要素が展開されています。

"false"

この要素が所有または制御しているグループ化要素が折り畳まれています。

"undefined"

この要素は展開されているグループ化要素を所有または制御していません。

この例では、ID が animal の要素の aria-expanded 属性は "false" に設定されています。ariaExpanded を使用して、値を "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

仕様書

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

ブラウザーの互換性

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.

AltStyle によって変換されたページ (->オリジナル) /