ARIA: aria-description 属性
全局 aria-description
属性定义一个字符串值,该值用于描述或注解当前元素。
注意: aria-description
目前仍处于 W3C ARIA 1.3 的编辑草案阶段。在此期间,请继续使用 aria-describedby
,该属性自 ARIA 1.1 起就已支持。
描述
全局 aria-description
属性提供了一种机制,供开发者描述或注解当前元素,为辅助技术用户提供更丰富的上下文信息。
<div
role="application"
aria-label="calendar"
aria-description="Game schedule for the Boston Red Sox 2021 Season">
<h1>Red Sox 2021</h1>
<div role="grid">…</div>
</div>
aria-description
属性与 aria-label
相似,都提供了一个与元素关联的文本字符串。但是,标签(label)应简短而简洁,而描述(description)可以更长,因为其目的是提供更多的上下文和信息。
aria-description
和 aria-describedby
属性具有相同的目的;都为用户提供有关其设置对象的附加描述性文本。如果 DOM 中存在描述性文本,请使用 aria-describedby
替代。
只有在不希望提供可见描述的情况下,才应使用 aria-description
属性。aria-describedby
属性的值是包含有关该对象的描述性文本的元素的 id
列表。当没有合适的描述性文本可以通过 id
引用与对象关联时,则使用 aria-description
。如果同时存在这两个属性,则 aria-describedby
在定义 可访问描述 属性时具有优先权。
无论是通过 aria-description
还是 aria-describedby
设置的描述内容,都应为纯文本。如果内容非常长、具有语义要求或结构上的导航性,请使用 aria-details
替代。
值
<string>
-
其值是一个字符串,一种无约束的值类型,旨在传达给辅助技术的用户。
相关接口
Element.ariaDescription
-
ariaDescription
属性是Element
接口的一部分,它反映了aria-description
属性的值,该属性定义了一个用于描述或注解当前元素的字符串值。
相关角色
用于 **所有** 角色。
规范
规范 |
---|
无障碍富互联网应用程序 (WAI-ARIA) # aria-description |