Use when applies to hyperlinks (`<a>` elements) that appear inline within paragraphs or text blocks. Does not apply to navigation menus, button-style links, or
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-link-in-text-block-f24fa844e7d6 ,按照其中的说明把「link-in-text-block」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
Approximately 8% of men and 0.5% of women have color vision deficiency (red-green being most common). If links are distinguished only by a color like blue or red, these users may not identify them as links and miss critical navigation or reference information. The underline is a universal, color-independent signal understood across cultures and vision abilities. Removing underlines is a common design trend that disproportionately affects users with low vision and cognitive disabilities.
Find all <a> elements within text-heavy containers (paragraphs, article body, list items containing prose). Check the CSS applied: if text-decoration: none or text-decoration: underline is removed, verify that the link color has at least 3:1 contrast ratio against the surrounding non-link text color AND at least 4.5:1 against the background. Also check :hover and :focus states for a non-color visual change (underline appearing, outline, background change).
The simplest fix is to restore text-decoration: underline on inline text links within body copy — this is the most widely understood and color-independent link indicator. If the design requires no underline: calculate the contrast between link color and body text color using the WCAG relative luminance formula; it must be ≥ 3:1. Add a non-color visual change on :hover and :focus (e.g., underline appears, font-weight changes, or background-color is added).
WCAG 2.1 SC 1.4.1 (Use of Color, Level A) states that color must not be the sole visual means of conveying information, indicating an action, prompting a response, or distinguishing a visual element. For links within text, this means a user who cannot perceive the link color must still be able to identify the link. The WCAG technique G183 specifies that a 3:1 contrast ratio between link and surrounding text, combined with a non-color hover/focus cue, is a sufficient technique. The browser default underline satisfies SC 1.4.1 on its own.
Review the rendered markup and interactive states that affect Make links in text blocks visually distinguishable. Flag exact elements, roles, labels, focus behavior, or keyboard interactions that violate the rule, and note how to verify the fix with browser accessibility tooling or assistive tech.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/en/rules/accessibility/link-in-text-block