Sub topic 10
Labels that say what happens next
This chapter assumes you can write basic HTML and CSS, and that you know the difference between a <button> and an <a> from the earlier chapter on choosing the element. Here the question is what the element says. A button with perfect fill, contrast and focus styling still fails if the user can't tell what will happen when they use it.
Why the label is part of the affordance
Shape and color tell a user that something can be activated. The label tells them what activation does. People scan pages quickly, so they often read only the clickable text and skip the sentence around it. A good label works on its own.
Screen reader users depend on this even more. Screen readers can list every link on a page, or jump from button to button, with the surrounding text removed. A page full of "Click here" and "Read more" becomes a list of identical, meaningless entries.
Start with a verb for buttons
A button performs an action, so its label should name that action. Put a verb first, and add the object when the verb alone is vague.
| Weak label | Better label | Why |
|---|---|---|
| OK | Save changes | Names the result |
| Submit | Create account | Says what is being created |
| Yes | Delete project | Still makes sense if the dialog text is skipped |
| Go | Search flights | Names the object |
| Continue | Continue to payment | Shows the next step |
Some rules that hold up in practice:
- Use the same words the user would use. "Sign in" and "Log in" are both fine, but pick one.
- Keep labels short, usually one to four words. Long labels wrap, and wrapping breaks the compact, pressable shape you built in the visual design chapter.
- Use sentence case ("Save changes") or title case, but not all capitals typed into the HTML. If you want capitals, use
text-transformso screen readers and copy-paste still get normal text. - Do not use vague pairs like "OK" and "Cancel" for anything with consequences. A dialog that asks "Delete this project?" should offer "Delete project" and "Keep project".
Write link text that names the destination
A link navigates, so its label should describe where the user will land or what they will get. Compare these:
<p>To see our pricing, <a href="/pricing">click here</a>.</p>
<p>Compare plans on the <a href="/pricing">pricing page</a>.</p>The first link's text is "click here". Heard out of context, it says nothing. The second link works on its own, and the sentence still reads naturally.
Avoid these patterns:
- "Click here", "here", "this link", "link". The user already knows it is a link.
- "Read more" and "Learn more" repeated on every card in a list.
- A raw URL as link text in running prose, because screen readers spell it out character by character.
- Link text that is the whole sentence. Wrap the most informative phrase and no more.
WCAG 2.4.4 (Link Purpose, In Context) requires that a link's purpose can be worked out from its text together with its surrounding context. Level AAA criterion 2.4.9 asks for the purpose to be clear from the link text alone. Aim for the stricter standard because it costs almost nothing.
Repeated links: "Read more" on cards
Cards in a list often share the same call to action. You have three ways to fix this.
- Make the headline the link and drop the "Read more" entirely. This is the simplest option and gives the largest target.
- Write a distinct label for each card, such as "Read the Flexbox guide".
- Keep "Read more" visually but add hidden text that completes it for assistive technology.
Option 3 uses a visually hidden class. The text is removed from view but stays in the accessibility tree.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Card links</title>
<style>
.visually-hidden {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
border: 0;
}
</style>
</head>
<body>
<article>
<h2>Flexbox basics</h2>
<p>Lay out rows and columns without floats.</p>
<a href="/guides/flexbox">
Read more<span class="visually-hidden"> about Flexbox basics</span>
</a>
</article>
<article>
<h2>Grid basics</h2>
<p>Build two-dimensional layouts with named areas.</p>
<a href="/guides/grid">
Read more<span class="visually-hidden"> about Grid basics</span>
</a>
</article>
</body>
</html>A screen reader announces "Read more about Flexbox basics, link". Sighted users see the short label. Note the leading space inside the hidden span. Without it the words run together as "Read moreabout".
Icon-only buttons need a name
A button that shows only an icon has no text for a screen reader to announce. Give it an accessible name.
<button type="button" aria-label="Close dialog">
<svg aria-hidden="true" width="16" height="16" viewBox="0 0 16 16">
<path d="M2 2l12 12M14 2L2 14" stroke="currentColor" stroke-width="2" fill="none"/>
</svg>
</button>The aria-label supplies the name, and aria-hidden="true" on the SVG stops the icon from being announced as an unnamed graphic. Prefer visible text when space allows. Many users do not recognize icons beyond a few conventions (a magnifier for search, an X for close), and a visible word helps people with cognitive disabilities and people who speak another language.
Keep the visible label inside the accessible name
Speech-control users activate a control by saying its visible text, such as "click Search". If you set an aria-label that differs from what is shown, the command can fail. WCAG 2.5.3 (Label in Name) says the accessible name must contain the visible text.
<!-- Fails: the accessible name does not contain "Search" -->
<button type="submit" aria-label="Find items">Search</button>
<!-- Passes: the visible text starts the accessible name -->
<button type="submit" aria-label="Search the catalog">Search</button>
<!-- Best: no aria-label needed -->
<button type="submit">Search catalog</button>The safest approach is to put the full meaning in visible text and add no ARIA at all. Reach for aria-label only when there is no visible text.
Say what is unusual about the destination
Users form an expectation from the label. Break that expectation and you lose trust. Tell them in the label when a link:
- opens in a new tab or window: "Pricing (opens in a new tab)"
- downloads a file: "Download annual report (PDF, 2.4 MB)"
- leaves your site for another domain
- starts a long or irreversible process
<a href="/reports/2025.pdf" download>
Download annual report <span class="file-meta">(PDF, 2.4 MB)</span>
</a>
<a href="https://example.org/spec" target="_blank" rel="noopener noreferrer">
Read the specification <span class="file-meta">(opens in a new tab)</span>
</a>Opening a new tab should be the exception. When you do it, the warning belongs in the text itself, not only in an icon.
Labels during and after the action
The label can change to show progress, which connects to the loading states covered in a later chapter. Keep the verb and add the state: "Saving…" while the request runs, then return to "Save changes" or show "Saved". If you swap the text, keep the button width stable, for example with min-width, so the layout does not jump.
Consistency across the site
Use one label for one action everywhere. If the same operation is "Remove" on one page, "Delete" on another and "Discard" on a third, users have to relearn it each time. Keep a short list of the labels your product uses and check new screens against it. This is also where the shared button styles from the consistency chapter pay off, because label and appearance then form one pattern.
A decision path for choosing a label
Common errors
- Using "Submit" everywhere. Replace it with the specific result.
- Mismatched
aria-label. The visible text is missing from the accessible name. - Identical link text with different destinations. Two links named "Details" that go to different pages break WCAG 2.4.4 unless context separates them.
- Hiding text with
display: none. That removes it from the accessibility tree too. Use the visually hidden pattern above instead. - A link that acts like a button. A "Delete" label on an
<a href="#">promises an action, but a link navigates. This is the mismatch from the previous chapter, now visible in the wording.
Exercise
A card list has three cards, each ending with the link text "Learn more" that goes to a different article. Name two ways to fix this for screen reader users, and say why adding aria-label="Article" to each link would be a poor fix.
Show answer
One fix is to make each card's headline the link and remove "Learn more". Another is to keep "Learn more" and append visually hidden text naming the article, such as <span class="visually-hidden"> about Flexbox basics</span>. A fixed aria-label="Article" would replace the visible text in the accessible name, so it breaks label in name (the visible words "Learn more" would not be in the name), and it would give all three links the same name, so they still could not be told apart.
Exercise
Rewrite these labels so each says what happens next: a button "OK" that saves a profile, a link "Click here" to a refund policy, and a link to a 5 MB PDF invoice that opens a download.
Show answer
"Save profile" for the button. "Read our refund policy" for the first link, with only the phrase "refund policy" or the whole short phrase as the link. "Download invoice (PDF, 5 MB)" for the third.