跳转到内容

noAmbiguousAnchorText

此内容尚不支持你的语言。

biome.json
{
"linter": {
"rules": {
"nursery": {
"noAmbiguousAnchorText": "error"
}
}
}
}

Disallow ambiguous anchor descriptions.

Enforces <a> values are not exact matches for the phrases “click here”, “here”, “link”, “a link”, or “learn more”. Screen readers announce tags as links/interactive, but rely on values for context. Ambiguous anchor descriptions do not provide sufficient context for users.

<a>learn more</a>
code-block.html:1:1 lint/nursery/noAmbiguousAnchorText ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

No ambiguous anchor descriptions allowed.

> 1 │ <a>learn more</a>
^^^^^^^^^^^^^^^^^
2 │

Ambiguous anchor descriptions do not provide sufficient context for screen reader users. Provide more context to these users.

<a>documentation</a>

The words option allows users to modify the strings that can be checked for in the anchor text. Useful for specifying other words in other languages.

Default ["click here", "here", "link", "a link", "learn more"]

biome.json
{
"linter": {
"rules": {
"nursery": {
"noAmbiguousAnchorText": {
"options": {
"words": [
"click this"
]
}
}
}
}
}
}
<a>click this</a>