Skip to content

roleRequiredAriaProps

Reports ARIA roles missing their required ARIA properties.

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

ARIA roles define how elements are exposed to assistive technologies like screen readers. Some roles require specific ARIA properties to function correctly and provide meaningful information to users. Omitting these required properties can result in incomplete or confusing experiences for users of assistive technologies.

<
JSX.IntrinsicElements.div: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>
div
HTMLAttributes<HTMLDivElement>.role?: AriaRole | undefined
role
="checkbox" />
<div
HTMLAttributes<HTMLDivElement>.role?: AriaRole | undefined
role
="slider"
AriaAttributes["aria-valuenow"]?: number | undefined

Defines the current value for a range widget.

@seearia-valuetext.

aria-valuenow
="5" />
Error ts(2322) ― Type '{ role: "slider"; "aria-valuenow": string; }' is not assignable to type 'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>'. Type '{ role: "slider"; "aria-valuenow": string; }' is not assignable to type 'HTMLAttributes<HTMLDivElement>'. Types of property '"aria-valuenow"' are incompatible. Type 'string' is not assignable to type 'number'.
<
JSX.IntrinsicElements.span: DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>
span
HTMLAttributes<HTMLSpanElement>.role?: AriaRole | undefined
role
="combobox" />
<
JSX.IntrinsicElements.div: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>
div
HTMLAttributes<HTMLDivElement>.role?: AriaRole | undefined
role
="heading" />

If you are using a custom framework that populates valid ARIA property roles for you, you might not need this rule.

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