Coder Social home page Coder Social logo

scottaohara / a11y_breadcrumbs Goto Github PK

View Code? Open in Web Editor NEW
48.0 6.0 3.0 48 KB

Accessible breadcrumb pattern

Home Page: https://scottaohara.github.io/a11y_breadcrumbs/

License: MIT License

CSS 20.34% HTML 79.66%
breadcrumb-navigation a11y accessibility

a11y_breadcrumbs's Introduction

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.

<nav class="breadcrumb-nav" aria-label="breadcrumb">
  <ol>
    <li>
      <a href="...">
        Index
      </a>
    </li>
    <li>
      <a href="...">
        Sub page
      </a>
    </li>
    <li>
      <a href="..." aria-current="page">
        The current page
      </a>
    </li>
  </ol>
</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 :)

a11y_breadcrumbs's People

Contributors

bricksroo avatar patrickhlauke avatar scottaohara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

a11y_breadcrumbs's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.