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

ARIA: log role

· 52CE 我爱测

The `log` role is used to identify an element that creates a live region where new information is added in a meaningful order and old information may disappear.

The log role is used to identify an element that creates a live region where new information is added in a meaningful order and old information may disappear.

Description

A log is a type of live region where new information is added in meaningful order and old information may disappear. Examples include chat logs, messaging history, game log, or an error log. In contrast to other live regions, in this role there is a relationship between the arrival of new items in the log and the reading order. The log contains a meaningful sequence and new information is added only to the end of the log, not at arbitrary points.

In contrast to other types of live region, a log is sequentially ordered and new information is only added to the end of the log. When this role is added to an element, the browser will send out an accessible log event to assistive technology products which can then notify the user about it.

By default, updates contain only the changes to the live region and these are announced when the user is idle. Elements with the role log have an implicit aria-live value of polite. Where the user needs to hear the entire live region upon a change aria-atomic="true" should be set. To have announcements made as soon as possible and where the user may be interrupted, aria-live="assertive" can be set for more aggressive updates.

Associated WAI-ARIA roles, states, and properties

  • aria-atomic

    • : Defines whether assistive technologies should present all, or only parts of, the changed region. Elements with the role log have an implicit aria-atomic value of false.
  • aria-live

    • : Defines when assistive technology should inform the user of updates to content. Elements with the role log have an implicit aria-live value of polite, meaning screen readers will announce changes inside the log when the user is idle.
  • aria-label and aria-labelledby

    • : The log is required to have an accessible name. Use aria-labelledby if a visible label is present, otherwise use aria-label.

Best practices

With an area that has scrolling text, such as a stock ticker, the marquee role should be used instead.

Specifications

See also

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

资料来源与适用范围

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

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

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