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

ARIA: region role

· 52CE 我爱测

The **`region`** role is used to identify document areas the author deems significant. It is a generic landmark available to aid in navigation when none of the other landmark roles are appropriate.

The region role is used to identify document areas the author deems significant. It is a generic landmark available to aid in navigation when none of the other landmark roles are appropriate.

<div role="region" aria-label="Example">
  
</div>

Description

The region role is an ARIA landmark role. The region role should be reserved for sections of content sufficiently important that users will likely want to navigate to the section easily and to have it listed in a summary of the page. A region role is a more generic term, and should only be used if the section needing to be identified is not accurately described by one of the other landmark roles, such as banner, main, contentinfo, complementary, or navigation.

Every element with a region role should include a label that describes the purpose of the content in the region, preferably with an aria-labelledby referencing a visible header. If no visible appropriate header is present, aria-label should be used.

The region landmark role's content should make sense if separated from the main content of the document.

Using the section element will automatically communicate a section has a role of region if it is given an accessible name. Developers should always prefer using the correct semantic HTML element, in this case <section>, over using ARIA.

Associated WAI-ARIA roles, states, and properties

  • aria-labelledby or aria-label
    • : Use this attribute to label the region. Often, the value of the aria-labelledby attribute will be the id of the element used to title the section. If no visible appropriate header is present, aria-label should be used.

Examples

<div role="region" aria-labelledby="region-heading">
  <h2 id="region-heading">
    This heading's `id` attribute helps this region have an accessible name
  </h2>
  
</div>

Accessibility concerns

Use sparingly! Landmark roles are intended to be used sparingly, to identify larger overall sections of the document. Using too many landmark roles can create "noise" in screen readers, making it difficult to understand the overall layout of the page.

Only use the region role if no other relevant content sectioning element or landmark role applies. If multiple regions exist on a page, it may be worth reinvestigating the page's overall structure.

Best practices

Prefer HTML

Using the section element will automatically communicate that the element has a role of region. If possible, prefer using the semantic <section> element instead of the region role.

Labeling landmarks

If there is more than one region landmark role in a document, provide a unique label for each one. This label will allow an assistive technology user to be able to quickly understand the purpose of each landmark.

<div role="region" aria-labelledby="use-discretion">
  <h3 id="use-discretion">Please use the `region` role with discretion</h3>
  
</div>

…

<div role="region" aria-labelledby="please-reconsider">
  <h3 id="please-reconsider">Please reconsider your document structure</h3>
  
</div>

In this example, the region's label is being generated by the aria-labelledby attribute.

Scrolling content areas with overflow text

A scrollable area may need tabindex="0" to let keyboard-only users focus and scroll it. This does not, by itself, make the area a landmark. Reserve role="region" for a sufficiently important section of the page that users should be able to find through landmark navigation, and give each such region a descriptive, unique accessible name (for example, with aria-labelledby). For ordinary scrollable content that does not warrant a landmark, see the group role.

SVG

role="region" can be declared on areas of svg along with an aria-label to allow individual sections of the SVG to be described.

Specifications

See also

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

资料来源与适用范围

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

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

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