ARIA: Complementary role - Accessibility 编辑

The complementary landmark role is used to designate a supporting section that relates to the main content, yet can stand alone when separated. These sections are frequently presented as sidebars or call-out boxes. If possible, use the HTML <aside> element instead.

<div role="complementary">
  <h2>Our partners</h2>
  <!-- complementary section content -->
</div>

This is a sidebar containing links to event sponsors.

Description

The complementary role is a landmark role. Landmarks can be used by assistive technology to quickly identify and navigate to large sections of the document. Content listed within a container with the complementary landmark role should make sense if separated from the main content of the document.

Using the <aside> element will automatically communicate a section has a role of complementary. Developers should always prefer using the correct semantic HTML element over using ARIA.

Examples

<div role="complementary">
  <h2>Trending articles</h2>
  <ul>
     <li><a href="#">18 tweets that will make you feel all the feels</a></li>
     <li><a href="#">Stop searching for the perfect lunch containers because I've found them</a></li>
     <li><a href="#">The time has come to finally decide what we should be calling these foods</a></li>
     <li><a href="#">17 really good posts we saw on Tumblr this week</a></li>
     <li><a href="#">10 parent hacks we know work because we tried them</a></li>
   </ul>
 </div>

Accessibility concerns

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.

Best practices

Prefer HTML

Using the <aside> element will automatically communicate a section has a role of complementary. If at all possible, prefer using it instead.

Labeling landmarks

Multiple landmarks

If there is more than one complementary landmark role or <aside> element in a document, provide a label for each landmark using the aria-label attribute, or, if the aside has an appropriately descriptive title, point to it with the aria-labelledby attribute. This label will allow an assistive technology user to be able to quickly understand the purpose of each landmark.

<aside aria-label="Note about usage">
  <!-- content -->
</aside>

...

<aside id="sidebar" aria-label="Sponsors">
  <!-- content -->
</aside>

Redundant descriptions

Screen readers will announce the type of role the landmark is. Because of this, you do not need to describe what the landmark is in its label. For example, a declaration of role="complementary" with an of aria-label="Sidebar" may be announced redundantly as, "complementary sidebar".

Added benefits

Certain technologies such as browser extensions can generate lists of all landmark roles present on a page, allowing non-screen reader users to also quickly identify and navigate to large sections of the document.

Specifications

SpecificationStatus
Accessible Rich Internet Applications (WAI-ARIA) 1.1
The definition of 'ARIA: Complementary role' in that specification.
Recommendation
WAI-ARIA Authoring Practices
The definition of 'Complementary landmark role' in that specification.
Working Draft

Screen reader support

TBD

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:101 次

字数:6951

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文