Link Text Check

Flags "click here", bare URLs and empty links that make no sense to screen reader users browsing a list of links, and suggests better text.

StopsClick here links fail screen readers

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/link-text-check.json

The files land in your project. They're yours to edit.

Usage

link-text-check-usage.tsx
import { LinkTextCheck } from "@/components/ui/link-text-check"

<LinkTextCheck markdown={markdown} onMarkdownChange={setMarkdown} />

What it catches

  • Generic text such as "click here" and "read more"
  • Raw URLs used as link text
  • Empty links, including linked images with no alt
  • The same text pointing to different destinations
  • Rewrite suggestion from the surrounding sentence

Props

LinkTextCheck props
PropTypeDefault
markdown

Markdown to check. With `onMarkdownChange`, problems get one-tap rewrites.

string—
onMarkdownChange

Called with the rewritten Markdown when a fix is tapped.

(markdown: string) => void—
target

Live mode: check the links inside this element as it changes. Rows focus the link.

React.RefObject<HTMLElement | null>—
onJump

Called when a link is chosen (markdown mode), e.g. to select it in the editor.

(link: LinkItem) => void—
genericText

Text treated as meaningless out of context. Replace it to translate.

string[]GENERIC_LINK_TEXT
title

Heading shown above the check.

string"Links"
summaryText

`{count}` is filled in.

string"{count} to fix"
allGoodText

Shown when no problems are found.

string"Every link says where it goes"
emptyText

Shown when there are no links.

string"No links yet."
issuesLabel

Accessible label for the issues list.

string"Issues"
listLabel

Heading for the links-list preview.

string"Links list"
listHint

Explains the links-list preview.

string"How a screen reader's links list reads them, out of cont…
emptyLinkText

Shown in place of the text of an empty link.

string"No text"
linkRoleText

Prefix a screen reader says before each link.

string"link"
fixLabel

`{text}` is filled in.

string"Use “{text}”"
tryText

Shown instead of a fix in live mode. `{text}` is filled in.

string"Try “{text}”"
messages

Override any issue message.

Partial<typeof LINK_TEXT_MESSAGES>—

* required. Also accepts the native props of <section> (className, aria-*, data-*…), passed through to it.

Accessibility

  • Section is labelled; summary is a polite live region
  • Rows focus the link in live mode; smooth scroll is skipped under reduced motion
  • Focus returns to a nearby fix after applying one

Only what the source does. Test with your own screen reader and content before shipping.

Limitations

  • English generic phrases by default; pass genericText to translate
  • Suggested rewrites need a human check
  • Doesn't check link targets or contrast

What it stops

Click here links fail screen readers

Also known as

link text · a11y · accessibility · wcag · anchor text · screen reader · cms · rich text editor

Field type

Dependencies

Pairs well with