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

ARIA: aria-readonly attribute

· 52CE 我爱测

The `aria-readonly` attribute indicates that the element is not editable, but is otherwise operable.

The aria-readonly attribute indicates that the element is not editable, but is otherwise operable.

Description

When you want to indicate that an interactive element works but is not editable, set aria-readonly="true". This indicates to the user that an interactive element that would normally be focusable and copyable has been placed in a read-only (not disabled) state.

When aria-readonly is set to true, it means the user can read but not set the value of the widget. Read-only elements are still relevant to the user, so you should not prevent the user from navigating to the element or its focusable descendants or copying the value.

Examples include:

  • Form elements which should not be changed.
  • Row and column headers in a spreadsheet.
  • The total value in a shopping cart.

If the element is unavailable for interaction, use aria-disabled instead.

[!NOTE] When using semantic HTML form controls, if you set the readonly attribute, you don't need to include aria-readonly="true".

[!NOTE] The value of <input type="checkbox"> cannot be edited making readonly not relevant. However, when creating checkboxes with role="checkbox" the aria-readonly attribute is supported.

Values

  • true
    • : The element is readonly.
  • false (default)
    • : The element is not readonly.

Associated interfaces

  • Element.ariaReadOnly
    • : The ariaReadOnly property, part of the Element interface, reflects the value of the aria-readonly attribute.
  • ElementInternals.ariaReadOnly
    • : The ariaReadOnly property, part of the ElementInternals interface, reflects the value of the aria-readonly 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

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

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