Element: ariaSelected プロパティ
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.
Please help us by answering a few questions.
ariaSelected
は Element
インターフェイスのプロパティで、aria-selected
属性の値を反映し、選択状態を持つ要素の現在の "selected" 状態を示します。
値
以下のいずれかの値を持つ文字列です。
"true"
-
この項目は選択されています。
"false"
-
この項目は選択されていません。
"undefined"
-
この項目は選択できません。
例
この例では、ID が tab-id
の要素の aria-selected
属性は "true" に設定されています。ariaSelected
を使用して値を "false" に更新します。
html
<button role="tab" aria-selected="true" aria-controls="tabpanel-id" id="tab-id">
Tab label
</button>
js
let el = document.getElementById("tab-id");
console.log(el.ariaSelected); // true
el.ariaSelected = "false";
console.log(el.ariaSelected); // false
仕様書
Specification |
---|
Accessible Rich Internet Applications (WAI-ARIA) # dom-ariamixin-ariaselected |