Skip to content
Critiq Docs

Search docs

Search documentation pages and rules

correctness.ui

Use real destinations for anchor elements

Links need a concrete `href` so navigation, keyboard activation, and assistive technologies behave predictably.

#Metadata

Rule ID
ts.react.no-invalid-anchor-href
Severity
medium
Confidence
0.82
Languages
javascript, typescript
Presets
strict
Stability
experimental
Applies to
function
Tags
accessibility, react, rules-catalog, ui

#Why it matters

Placeholder anchors and `javascript:` URLs break expectations for links, harm accessibility, and often hide ad-hoc click handlers that should be buttons instead.

#Remediation

Point `href` at a real URL or in-page fragment, use a native button for actions, or add an explicit widget role with keyboard support when mimicking controls.

#Repository path

The generated metadata points to critiq-rules/libs/rules/catalog/rules/typescript/ts.react.no-invalid-anchor-href.rule.yaml.