ARIA: banner role - Accessibility 编辑

A banner role represents general and informative content frequently placed at the beginning of the page. This usually includes a logo, company name, search icon, photo related to the page, or slogan.

<div role="banner">
  <img src="companylogo.svg" alt="my company name" />
  <h1>Title</h1>
  <h2>Subtitle</h2>
</div>

By default, the HTML5 <header> element has an identical meaning to the banner landmark, unless it is a descendant of <aside>, <article>, <main>, <nav>, or <section>.

    Description

    A banner landmark role converts the container element upon which it is applied into a header. It should be reserved for the site header content that is common across the site generally at the top of every page.

    The banner is typically includes things a logo or corporate identity, possibly a site-specific search tool, and is generally what your marketing team would call the header or top banner of the site. If the header element technique is not being used for that banner, a declaration of role="banner" should be used to define a banner landmark to assistive technologies.

    Assistive technologies can identify the main header element of a page as the banner if is a descendant of the body element, and not nested within an article, aside, main, nav or section subsection.

    Each page may have a banner landmark, but each page should be limited to only one header with the role of banner. In the case of a page containing nested document and/or application roles, each nested document or application role may also have one banner landmark. If a page includes more than one banner landmark, each should have a unique label.

    Associated ARIA roles, states, and properties

    None

    Keyboard interactions

    None

    Required JavaScript features

    None

    Examples

    Here's a fake simple banner with a skip to navigation link, a logo, a title and a subtitle. As this is the main header for the site, we've added the banner landmark role to the container element.

    <div role="banner">
      <a href="#nav" id="skipToMenu" class="skiptocontent">Skip To Keyboard Navigation</a>
      <img src="images/w3c.png" alt="W3C Logo">
      <h1>ARIA Landmarks</h1>
      <p>Identifying page subsections for easy navigation</p>
    </div>

    We could also have written the above with the HTML header element:

    <header>
      <a href="#nav" id="skipToMenu" class="skiptocontent">Skip To Keyboard Navigation</a>
      <img src="images/w3c.png" alt="W3C Logo">
      <h1>ARIA Landmarks</h1>
      <p>Identifying page subsections for easy navigation</p>
    </header>

    Best practices

    While it is best to use the header element and ensure it is not a descendant of any subsection of the page, sometimes you don't have access to the underlying HTML. If this is the case, you can add the role of banner to the main header of the page with JavaScript. Identifying the page's banner in this way will help improve the site's accessibility.

    Specifications

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

    Screen reader support

    TBD

    See also

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

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

    发布评论

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

    词条统计

    浏览:114 次

    字数:6320

    最后编辑:8 年前

    编辑次数:0 次

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