Links

Text links are simple but important to get right. Every link inside a .ds-page is the inline text link, with no class to add, and appears in Link Blue, a special blue reserved only for this purpose. Do not override link styles, the colors are carefully chosen to maintain accessibility contrasts in light and dark modes and on tinted and shaded backgrounds.

One link, four states. At rest it is Link Blue with a 1px underline set 2px below the text. On hover the color deepens and the underline thickens. Once followed it turns Visited Purple. When reached by keyboard it shows a 3px Link Blue ring. The four colors are in the tokens table, read live from the stylesheet.

Note

All states meet accessibility guidelines WCAG 2.2 SC 1.4.1 Use of Color (Level A), WCAG 2.2 SC 1.4.3 Contrast (Minimum) (Level AA), and WCAG 2.2 SC 2.4.7 Focus Visible (Level AA)

Read the Endorsement policy before you ask a colleague to endorse you.

Relevant code
<p>Read the <a href="/help/endorsement">Endorsement policy</a> before you ask a colleague to endorse you.</p>
<a href> inside .ds-page
Every anchor with an href inside a .ds-page takes the link treatment: the color, the underline, and the hover, visited and focus states. There is no class to add, and the dark values arrive through the same token flip as everything else.

Inline body links must be underlined

Color contrast against body text is only 3.0:1 in light mode and 1.9:1 in dark mode — too marginal to rely on alone. Underlines are mandatory for inline links per DESIGN-POLICIES.md and WCAG 1.4.1 (use of color). Standalone navigation links (header, footer, button-like surfaces) may omit the underline.

A link goes somewhere: it has an href, it is underlined, and it remembers being visited. A text-only button does something on this page, such as opening a panel or copying a value: it is Link Blue too, but has no underline and no visited state. Use the one that matches what happens when it is pressed. Text-only buttons are described on Buttons.

Note

Meets accessibility guideline WCAG 2.2 SC 4.1.2 Name, Role, Value (Level A)

Submitted 14 Jan 2024 · view revision history ·

Relevant code
<p>
  Submitted 14 Jan 2024 · <a href="/abs/2401.00001v2">view revision history</a> ·
  <button class="ds-btn ds-btn-text" type="button" aria-expanded="false">Show all versions</button>
</p>
<a href>
Goes to another page or another place on this one. Underlined, and takes the visited color once followed.
.ds-btn.ds-btn-text
Acts on this page. Plain Link Blue text with no underline and no visited state; the surrounding text sets its size. When it opens or closes something, add aria-expanded.

Linking to a section

A section heading can include a control that copies a link to that section, so a reader can point a colleague at the exact place. It is an option for long pages that readers cite or share in parts, such as HTML papers and these docs; most headings do not need it. Hover a heading on this page, or tab to it, and the control appears.

Note

Meets accessibility guidelines WCAG 2.2 SC 2.5.3 Label in Name (Level A) and WCAG 2.2 SC 4.1.3 Status Messages (Level AA)

A section heading Permalink to A section heading

The control as it appears on hover or focus. Here it is kept visible and copies nothing; the ones beside the headings on this page are live.

Relevant code
<!-- 1. The section heading, with an id -->
<section>
  <h2 id="dividers">Dividers</h2>
  …
</section>

<!-- 2. The scripts, once per page: copy.js copies, anchors.js adds the control -->
<script src="copy.js" defer></script>
<script src="anchors.js" defer></script>

<!-- What renders -->
<h2 id="dividers">Dividers
  <a class="ds-permalink" href="#dividers"><svg aria-hidden="true">…</svg>Permalink<span class="is-sr-only"> to Dividers</span></a>
</h2>
<section> > h2, h3
The section heading: the <h2> or <h3> that is the first element in a <section>. anchors.js adds the control to every section heading that has an id. No class is needed.
id
Written into the HTML, by hand or by whatever builds the page. These docs use verification/gen-anchors.py, which makes it from the heading text.
.ds-permalink
The control, a link to the section, <a href="#…">, with the link icon and the word “Permalink”, that anchors.js adds to every section heading with an id. With copy.js a press copies the link; without it, the link goes to the section, and the reader can copy the address from the address bar. It shows while the heading is hovered, while it has focus, and after a tap on a screen without hover. It stays in the tab order while it is hidden. After a copy, the link icon is a green tick (.ds-copy-done) for 2 seconds, in the same space, so the word does not move.
.is-sr-only
Completes the accessible name with the section: “Permalink to Dividers”. The name starts with the visible word.
[role="status"]
One region on the page. The script writes “Link to Dividers copied” into it and clears it with the tick.

A long list of links, such as the other pages in a set, is a list of links set in columns: no bullets, and as many columns as the width holds, so twenty links take a few lines rather than twenty. The page the reader is on stays in the list as a link, and the stylesheet sets it apart.

Relevant code
<nav aria-label="Archives">
  <ul class="ds-link-list ds-link-list--columns" role="list">
    <li><a href="/archive/astro-ph">Astrophysics</a></li>
    <li><a href="/archive/cond-mat">Condensed Matter</a></li>
    …
    <li><a href="/archive/math" aria-current="page">Mathematics</a></li>
    …
  </ul>
</nav>
.ds-link-list--columns
With .ds-link-list, on a <ul> with one link in each item. No bullets, and as many columns as fit, each at least 14rem wide: one column on a phone. The links run down each column, then across, in the order of the markup.
aria-current="page"
On the link to the page the reader is on, in any .ds-link-list. It stays a link. The stylesheet sets it in --ds-text and bold, so it does not rest on color alone, and a screen reader announces it as the current page.
role="list"
Keeps a list without bullets announced as a list: VoiceOver in Safari may not announce it otherwise.
<nav aria-label>
When the list is navigation, such as the other pages in a set, it sits in a <nav> with a name of its own. Use aria-label, not aria-labelledby pointing at the list's heading: a heading with a Permalink would add the Permalink's words to the name.

Accessibility essentials

Rules

Disabled state

A disabled link has no href, so it cannot be reached or followed by keyboard or pointer. pointer-events: none alone is not enough: it stops a mouse, but a keyboard can still follow the link. Add role="link" and aria-disabled="true", so a screen reader still announces it as a link that is unavailable, and the stylesheet colors it --ds-text-disabled (#aeaaa4). The underline stays so it is still recognizable as a (currently unavailable) link. The disabled state falls below AA on contrast — WCAG exempts disabled controls from contrast requirements.

A list of author names, a navigation bar, a footer column: these are lists in which every item is a link, and none of them is underlined. The underline exists to tell a link apart from the text around it, and in a list of links there is no such text; underlining every item would add visual noise and tell the reader nothing. WCAG asks for the underline only where color alone would have to separate a link from ordinary text, which is the case for an inline link and not for a list. The links keep Link Blue, the hover and focus states, and the visited color where it means something. Put .ds-link-list on the element that holds the list. A long list is set in columns, as Long lists of links shows.

Note

Meets accessibility guideline WCAG 2.2 SC 1.4.1 Use of Color (Level A). An underline is needed only where a link sits in running text; in a list, the layout shows which words are links.

Relevant code
<p class="ds-link-list">
  <a href="/a/palomares_a_1">Adrian Palomares</a>,
  <a href="/a/chen_m_1">Mei Lin Chen</a>,
  <a href="/a/mensah_k_1">Kwame Mensah</a>
</p>
.ds-link-list
On the element that holds the list. The links drop the underline at rest and keep Link Blue, the underline on hover, the focus ring and the visited color.

Visited memory

The Visited Purple is intentionally strong, not a faint after-state. Researchers reading long bibliographies and listings benefit from seeing what they have already followed up on; a too-subtle visited treatment defeats the purpose. If a specific surface (e.g., a navigation breadcrumb) needs to suppress visited styling, override :visited { color: inherit } locally.

Spec

Tokens

Four interactive states — default, hover, visited, focus — driven by --ds-link, --ds-link-hover and --ds-link-visited, with the dark values arriving through the same token flip as everything else. Per DESIGN-POLICIES: an inline body link is underlined; a standalone link, such as one in navigation, may omit it.

Read at runtime from design-system.css via getComputedStyle, so the values and ratios are those of the mode that is active. Use the theme control in the header to see the other mode. Contrast is measured on --ds-surface: 4.5:1 AA for the three text colors, and the 3:1 floor for the focus ring, which is a non-text cue.

TokenValueContrast on the surface