<nav class="cwf-skip-links" id="example-skip-links" aria-label="Skip links">
    <a class="cwf-skip-links__link" href="#" tabindex="1">
        Skip to content
    </a>
    <a class="cwf-skip-links__link" href="#" tabindex="2">
        Skip to footer
    </a>
</nav>
<nav class="cwf-skip-links"
    id="{{ id ?? 'cwf-skip-links' }}"
    aria-label="Skip links">
    {% for link in links %}
        <a class="cwf-skip-links__link"
            href="{{ link.url }}"
            tabindex="{{ loop.index }}">
            {{ link.name }}
        </a>
    {% endfor %}
</nav>
{
  "id": "example-skip-links",
  "links": [
    {
      "name": "Skip to content",
      "url": "#"
    },
    {
      "name": "Skip to footer",
      "url": "#"
    }
  ]
}
  • Content:
    // Skip link component styles
    
    @import "../../shared/animation";
    @import "../../shared/style";
    @import "../../shared/theme";
    
    $skip-links--background-color: style__color(black) !default;
    $skip-links--foreground-color: style__color(gold) !default;
    
    .cwf-skip-links {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin-left: 0;
        list-style: outside none;
        font-family: theme__font--sans-serif();
        --cwf-skip-links--background-color: #{$skip-links--background-color};
        --cwf-skip-links--foreground-color: #{$skip-links--foreground-color};
    }
    
    .cwf-skip-links__link {
        position: absolute;
        left: 15px;
        top: -100px;
        @include style__z-index(modal, top);
        height: auto;
        margin: 0 auto;
        padding: 10px 15px;
        background-color: transparent;
        text-decoration: none;
        outline: none;
        @include animation__transition(top, background-color);
        --cwf-link--color: var(--cwf-skip-links--foreground-color);
        --cwf-link--active--color: var(--cwf-skip-links--foreground-color);
    
        &:active,
        &:focus {
            top: 0;
            background-color: var(--cwf-skip-links--background-color);
        }
    }
    
  • URL: /components/raw/skip-links/_index.scss
  • Filesystem Path: components/skip-links/_index.scss
  • Size: 1.2 KB

Skip-links

The skip-links component is a navigation item providing links to key areas of interest on the current page, usually to the main content area and footer information. This component is not visible unless focused, and is intended mainly for screen reader users to bypass repetitive web page content to quickly get to critical information.

Structure

This component can contain any number of links, which have an href attribute set to the ID of the HTML element they point to. In addition, each link has a tabindex attribute set, the first with a tabindex of 1 and following links incrementing up by 1 from this; This ensures that these links are the first set of focusable elements on the page despite where it is included.

Usage

This component is to be the first within the body of every page.