Skip to content

Latest commit

 

History

History
32 lines (20 loc) · 865 Bytes

File metadata and controls

32 lines (20 loc) · 865 Bytes

Linter Rule: Require href attribute on <a> tags

Rule: html-anchor-require-href

Description

Disallow the use of anchor tags without an href attribute in HTML templates. Use if you want to perform an action without having the user navigated to a new URL.

Rationale

Anchor tags without href are unfocusable if user is using keyboard navigation, or is unseen by screen readers.

Examples

✅ Good

<a href="https://alink.com">I'm a real link</a>

🚫 Bad

<a data-action="click->doSomething">I'm a fake link</a>

References