headingContents
Reports heading elements without accessible content.
✅ This rule is included in the jsxlogicalandlogicalStrictpresets.
Heading elements (h1 through h6) must have content that is accessible to screen readers.
Empty headings provide no value and are misleading to search engine crawlers and users navigating with assistive technologies.
This is required for WCAG 2.4.6 compliance.
Examples
Section titled “Examples”<any
h1 /><any
h2></any
h2><any
h3> </any
h3><any
h1>Heading Content</any
h1><any
h2> <const TextWrapper: any
TextWrapper /></any
h2>;<any
h3 aria-label: string
aria-label="Heading" />When Not To Use It
Section titled “When Not To Use It”If you use a framework that automatically injects known good contents for heading elements, you can disable this rule.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- ESLint:
jsx-a11y/heading-has-content
Made with ❤️🔥 around the world by
the Flint team and contributors.