Navigation

The bars under the site header that tell a reader where they are inside an area or on a page: secondary navigation, two levels of it, steps, and the TOC bar.

Secondary navigation

A row of section links directly under the header, for an area that has its own sections, such as the account pages. It wraps onto a second line rather than scrolling sideways, so every section stays visible on a phone and at high zoom. Its links are tabs, in the same style as tabs within a page: the current one is a box joined to what follows it, with the accent along its top.

Note

Meets accessibility guideline WCAG 2.2 SC 1.4.1 Use of Color (Level A)

Search
Relevant code
<header class="ds-site-header">…</header>
<nav class="ds-subnav" aria-label="Account sections">
  <a href="/account">Account home</a>
  <a href="/account/submissions">Submissions</a>
  <a href="/account/works" aria-current="page">Works you own</a>
  <a href="/account/endorse">Endorse</a>
</nav>
.ds-subnav
A <nav> directly after the header, with an aria-label that names the area, such as “Account sections”. Plain links; never role="tab", which would promise arrow-key behavior that page links do not have. Hidden in print.
aria-current="page"
On the link for the current page. It shows as a bold tab joined to the page below, with the accent along its top, so the current section never depends on color alone, and a screen reader announces it. The current tab takes the background of the zone below it: the page ground (white in light mode) above primary content, or the secondary zone's tint (light gray in light mode) when the page opens with a secondary band.

Two levels of navigation

An area with its own sections, each with several views, such as a report with parts and views. A section menu starts the row, and the views of the current section follow it as tabs. The row keeps to one line by folding: first the views fold into a View menu beside the section menu, then the section menu takes a row of its own.

Note

The script answers to the width of the row, so the narrower examples fold inside narrower boxes. Open the menus to see their colors.

Full width

Tablet width

Phone width

Relevant code
<nav class="ds-subnav" aria-label="Moderator reports">
  <details class="ds-subnav-section">
    <summary>Submissions and holds</summary>
    <div class="ds-menu">
      <a href="/submissions" aria-current="true">Submissions and holds</a>
      <a href="/moderators">Moderators</a>
      <a href="/recruitment">Recruitment</a>
    </div>
  </details>
  <a href="/submissions">Overview</a>
  <a href="/submissions/charts" aria-current="page">Activity charts</a>
  <!-- … -->
</nav>
<script src="subnav.js" defer></script>
.ds-subnav-section
The section menu, a <details> at the start of the row: a cell in the accent's light tint, from the row's edge, with a hairline after it. Its summary names the current section; aria-current="true" marks it in the menu.
.ds-menu
A dropdown's menu: square corners and rows with hairlines, 32px with a mouse and 44px on a touch screen, hanging from its control. A menu opens in the background of the row it comes from. The tinted section cell counts as a row of its own, so its menu is tinted; the View menu, from the white row, is white.
<a> for each view
The row's own links, after the section menu, in the tab style. Each view is its own page.
<script src="subnav.js" defer>, .ds-subnav-views, .is-views-folded, .is-menu-row
The script, once per page. It builds the View menu (.ds-subnav-views) from the row's links and sets the state classes on the row: .is-views-folded when the views do not fit beside the section menu, and .is-menu-row when the section menu takes a row of its own. It closes an open menu on Escape and on a click outside. Without the script the tabs wrap.

Steps

The steps of one ordered process, such as a submission, and which one the reader is on. Steps is a variant of the secondary navigation bar. To move through a queue one item at a time, use the pager. Which steps are available is the application's logic: submission, for example, lets the reader go back to a complete step but not jump ahead.

Note

Meets accessibility guidelines WCAG 2.2 SC 1.3.1 Info and Relationships (Level A) and WCAG 2.2 SC 1.4.1 Use of Color (Level A)

Relevant code
<nav class="ds-subnav ds-subnav--steps" aria-label="Submission steps">
  <ol role="list">
    <li><a href="#"><span class="ds-step-number" aria-hidden="true"><svg …check…></span><span class="ds-step-label" data-label="Start">Start</span><span class="is-sr-only">, completed</span></a></li>
    <li><a href="#" aria-current="step"><span class="ds-step-number" aria-hidden="true">5</span><span class="ds-step-label" data-label="Metadata">Metadata</span></a></li>
    <li><a href="#"><span class="ds-step-number" aria-hidden="true">6</span><span class="ds-step-label" data-label="Categories">Categories</span></a></li>
    <li><span><span class="ds-step-number" aria-hidden="true">7</span><span class="ds-step-label" data-label="Preview">Preview</span><span class="is-sr-only">, not available yet</span></span></li>
  </ol>
</nav>
.ds-subnav--steps
On the secondary navigation bar. It holds an <ol role="list">, one <li> per step. It wraps onto more lines on a narrow screen, so every step stays visible.
.ds-step-number
The step number in a circle, hidden from screen readers because the list gives the position. A complete step shows a check mark instead of its number.
<a> for a complete step
A link, with the check mark and .is-sr-only text “, completed”.
aria-current="step"
On the link for the current step. Its name is bold, and its circle has a heavier border in the accent color.
.ds-step-label
The step's name, with the same name in data-label. Every step keeps the width of its name in bold, so the row does not move when the current step changes.
<a> for an available step
A link with its number.
<span> for a step not available yet
A <span>, not a link, so it is not a tab stop. A dashed circle and .is-sr-only text “, not available yet”.

TOC bar

Need in-page navigation? The TOC bar is a row that holds a single disclosure control, which opens a list of the page’s sections. By default the bar is sticky: it stays at the top of the viewport while the reader scrolls through the page. It can scroll away with the page instead.

Relevant code
<main class="ds-container">
  <div class="ds-full ds-zone-secondary">
    <header class="ds-page-header">
      <h1>Page title</h1>
      <p>One to five sentences that say what the page is for.</p>
    </header>
  </div>

  <div class="ds-full ds-toc-bar">
    <div class="ds-toc-bar-inner">
      <details class="ds-toc">
        <summary class="ds-toc-trigger">
          <svg aria-hidden="true">…</svg>
          <span class="ds-toc-text"><span class="ds-toc-prefix">Contents</span></span>
          <svg class="ds-toc-chevron" aria-hidden="true">…</svg>
        </summary>
        <nav class="ds-toc-menu" aria-label="Contents">
          <ol>      <!-- each section heading, word for word -->
            <li><a href="#secondary-navigation">Secondary navigation</a></li>
            …
          </ol>
        </nav>
      </details>
    </div>
  </div>

  <section>…</section>
</main>
<script src="toc.js" defer></script>
.ds-toc
The control, a <details>. It works on its own anywhere, and it opens with JavaScript off.
.ds-toc-trigger
The <summary>. Holds the list icon, .ds-toc-text with its .ds-toc-prefix, and .ds-toc-chevron.
.ds-toc-menu
The list, a <nav> holding an <ol>. The link to the current section gets .is-current. A page whose sections are numbered puts each number in .ds-toc-num.
.ds-toc-bar
The edge-to-edge row that holds the control. A direct child of .ds-container, with .ds-full. It comes directly after the page's opening band and sits on that band’s bottom edge (Secondary zones). By default the bar is sticky: it keeps to the top of the viewport, where it becomes .is-stuck and tightens, and it sets scroll-padding-top so an anchor lands below it. On a viewport shorter than 30rem, such as a phone on its side or a laptop at 400% zoom, it scrolls away with the page instead, so the reader keeps the height for the text. Whether a page has the bar follows its set, if it is in one (Organize complex page content), and it sticks unless it has .ds-toc-bar--scrolls; a page keeps at most one sticky bar (DESIGN-POLICIES).
.ds-toc-bar--scrolls
The bar scrolls away with the page instead of sticking, for a page that does not need its sections in view all the way down. An anchor then lands at the top of the viewport.
.ds-toc-bar-inner
The bar’s three-slot grid, which keeps the control centered whatever sits beside it.
[data-toc-scope]
Optional, on .ds-toc: a selector for the element whose headings fill an empty list. Without it, toc.js reads <main>, or the whole page when there is no <main>.

Accessibility essentials

Modifiers

Internal

The secondary navigation and steps in an internal tool. .ds-internal on a parent turns the current tab’s top line and the current step’s circle Access Lime, and the section menu’s background and lines the Access Lime washes.

Secondary navigation

Relevant code
<div class="ds-internal">
  <header class="ds-site-header">…</header>
  <nav class="ds-subnav" aria-label="Admin Console sections">
    <a href="/admin" aria-current="page">Dashboard</a>
    <a href="/admin/users">Users</a>
    <a href="/admin/moderators">Moderators</a>
  </nav>
</div>
.ds-internal
On a parent, it turns the current tab's top line Access Lime. Nothing else changes; see Secondary navigation.

Two levels of navigation

Relevant code
<div class="ds-internal">
  <nav class="ds-subnav" aria-label="Moderator reports">
    <details class="ds-subnav-section">
      <summary>Submissions and holds</summary>
      <div class="ds-menu">
        <a href="…" aria-current="true">Submissions and holds</a>
        <a href="…">Moderators</a>
        <a href="…">Recruitment</a>
      </div>
    </details>
    <a href="…">Overview</a>
    <a href="…" aria-current="page">Activity charts</a>
    <a href="…">Recent holds</a>
  </nav>
</div>
<script src="subnav.js" defer></script>
.ds-internal
On a parent, it turns the section menu's background, its hover and open state and its edge line to the Access Lime washes, and the current view's top line and the current row's bar in the open menu Access Lime. The markup and the folding are the same as in Two levels of navigation.

Steps

Relevant code
<div class="ds-internal">
  <nav class="ds-subnav ds-subnav--steps" aria-label="Review steps">
    <ol role="list">
      <li><a href="#"><span class="ds-step-number" aria-hidden="true"><svg …check…></span><span class="ds-step-label" data-label="Check">Check</span><span class="is-sr-only">, completed</span></a></li>
      <li><a href="#" aria-current="step"><span class="ds-step-number" aria-hidden="true">2</span><span class="ds-step-label" data-label="Classify">Classify</span></a></li>
      <li><span><span class="ds-step-number" aria-hidden="true">3</span><span class="ds-step-label" data-label="Announce">Announce</span><span class="is-sr-only">, not available yet</span></span></li>
    </ol>
  </nav>
</div>
.ds-internal
On a parent, it turns the current step’s circle Access Lime.