项目作者: scottaohara

项目描述 :
Accessible breadcrumb pattern
高级语言: HTML
项目地址: git://github.com/scottaohara/a11y_breadcrumbs.git
创建时间: 2017-04-03T19:41:58Z
项目社区:https://github.com/scottaohara/a11y_breadcrumbs

开源协议:MIT License

下载


Accessible Breadcrumbs

Standard pattern for breadcrumb navigations. Use this pattern with the help of your CMS or site generator of choice, to populate the breadcrumb navigation items.

How does it work?

A breadcrumb is a specific type of navigation pattern. It represents the path from the index, or home page, to the current page that one is viewing.

  1. <nav class="breadcrumb-nav" aria-label="breadcrumb">
  2. <ol>
  3. <li>
  4. <a href="...">
  5. Index
  6. </a>
  7. </li>
  8. <li>
  9. <a href="...">
  10. Sub page
  11. </a>
  12. </li>
  13. <li>
  14. <a href="..." aria-current="page">
  15. The current page
  16. </a>
  17. </li>
  18. </ol>
  19. </nav>

In the markup example, the <nav> element has an aria-label="breadcrumb" to announce this as a “breadcrumb navigation” to screen readers.

The <ol> is semantically appropriate, as these links are meant to be represented in a hierarchical structure. In reality though, the <ol> merely exposes the breadcrumb as a list. There is no difference between an <ol> and a <ul> if their listmarkers are removed.

The aria-current="page", or aria-current="location" should be placed on the last element in the breadcrumb navigation. This will append “current page (or) location” to the announcement of the link, generally after its accessible name has been announced. For example: “About, current page/location”.

CSS pseudo elements are used to add in dividers between the list elements. The current page is has unique style variations to help further distinguish it as the current page.

You can review the breadcrumb demo page for additional information and usage notes.

License & Such

This pattern was written by Scott O’Hara (Website, Twitter), referencing resources such as Using the aria-current attribute, and verifying with the ARIA Authoring Practices.

It has an MIT license.

Use it, modify it, contribute to it to help make your project more accessible :)