大网数据广告活动
Web 标准与前端开发

ARIA: aria-valuetext attribute

· 52CE 我爱测

The `aria-valuetext` attribute defines the human-readable text alternative of `aria-valuenow` for a range widget.

The aria-valuetext attribute defines the human-readable text alternative of aria-valuenow for a range widget.

Description

Numbers — even percentages — aren't always user-friendly. Assistive technologies present aria-valuenow as numeric values. If a progress bar is at 8%, what does that mean? aria-valuetext provides a way of presenting the current value in a more user-friendly, human-understandable way. For example, a battery meter value might be conveyed as aria-valuetext="8% (34 minutes) remaining".

The aria-valuetext attribute is used with the aria-valuenow attribute, not instead of it, unless that value is not known.

aria-valuetext is only needed when the numeric value of aria-valuenow is not meaningful. For example, a range's values are numeric but may be used for non-numeric values, such as college class level. The values of aria-valuenow for a 4-year college could range from 1 through 4, which indicate the position of each value in the value space. In this case, the aria-valuetext could be one of the strings: "first year", "sophomore", "junior", and "senior".

If the numeric value is meaningful, such as a spinner with aria-valuenow="3" for how many pizza slices you want to order, aria-valuetext is not needed.

When both the aria-valuetext and aria-valuenow are included, the aria-valuetext is announced. When there is no aria-valuetext attribute, assistive technologies will announce the aria-valuenow attribute for the current value.

Values

  • <string>
    • : A human-readable text alternative of the aria-valuenow value.

Associated interfaces

  • Element.ariaValueText
    • : The ariaValueText property, part of the Element interface, reflects the value of the aria-valuetext attribute.
  • ElementInternals.ariaValueText
    • : The ariaValueText property, part of the ElementInternals interface, reflects the value of the aria-valuetext attribute.

Associated roles

Used in roles:

Inherited into roles:

Specifications

See also

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。