Skip to content

anchorContent

Reports anchor elements without accessible content.

✅ This rule is included in the jsx logical and logicalStrict presets.

Automated tools such as screen readers and search engine crawlers rely on anchors (links) having contents to understand those links. If anchor is missing accessible content, then it will not be properly understood.

This rule checks that all anchors either have child content or an ARIA property describing the anchor.

<
JSX.IntrinsicElements.a: DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>
a
/>
<
JSX.IntrinsicElements.a: DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>
a
></
JSX.IntrinsicElements.a: DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>
a
>
<
JSX.IntrinsicElements.a: DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>
a
>
<
JSX.IntrinsicElements.span: DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>
span
AriaAttributes["aria-hidden"]?: Booleanish | undefined

Indicates whether the element is exposed to an accessibility API.

@seearia-disabled.

aria-hidden
/>
</
JSX.IntrinsicElements.a: DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>
a
>

If you are using a framework that automatically generates accessible content for anchors, you can safely disable this rule.

Made with ❤️‍🔥 around the world by the Flint team and contributors.