{"record":{"id":"10ae1410f0dd9878","repo":"oxc-project/oxc","slug":"the-attribute-attr-name-is-not-supported-by-th","errorCode":null,"errorMessage":"The attribute `{attr_name}` is not supported by the role `{role}`.","messagePattern":"The attribute `(.+?)` is not supported by the role `(.+?)`\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/jsx_a11y/role_supports_aria_props.rs","lineNumber":63,"sourceCode":"    /// ```\n    ///\n    /// Examples of **correct** code for this rule:\n    /// ```jsx\n    /// <ul role=\"radiogroup\" aria-required aria-labelledby=\"foo\">\n    ///     <li tabIndex=\"-1\" role=\"radio\" aria-checked=\"false\">Rainbow Trout</li>\n    ///     <li tabIndex=\"-1\" role=\"radio\" aria-checked=\"false\">Brook Trout</li>\n    ///     <li tabIndex=\"0\" role=\"radio\" aria-checked=\"true\">Lake Trout</li>\n    /// </ul>\n    /// ```\n    RoleSupportsAriaProps,\n    jsx_a11y,\n    correctness,\n    version = \"0.2.0\",\n    short_description = \"Enforce that elements only contain `aria-*` properties supported by their explicit or implicit role.\",\n);\n\nfn default(span: Span, attr_name: &str, role: &str) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\n        \"The attribute `{attr_name}` is not supported by the role `{role}`.\"\n    ))\n    .with_help(format!(\"Try to remove invalid attribute `{attr_name}`.\"))\n    .with_label(span)\n}\n\nfn is_implicit_diagnostic(span: Span, attr_name: &str, role: &str, el_name: &str) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"The attribute `{attr_name}` is not supported by the role `{role}`. This role is implicit on the element `{el_name}`.\"))\n        .with_help(format!(\"Try to remove invalid attribute `{attr_name}`.\"))\n        .with_label(span)\n}\n\nimpl Rule for RoleSupportsAriaProps {\n    fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {\n        let AstKind::JSXOpeningElement(jsx_el) = node.kind() else {\n            return;\n        };\n","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/jsx_a11y/role_supports_aria_props.rs#L45-L81","documentation":"This is the `jsx_a11y/role-supports-aria-props` rule in oxlint, default variant (constructor `default` at crates/oxc_linter/src/rules/jsx_a11y/role_supports_aria_props.rs:62). It fires when an element's explicit `role` does not support an `aria-*` attribute present on that element per the ARIA spec's role->supported-props table — e.g. `aria-checked` on `role=\"heading\"`. Announcing unsupported states gives screen readers garbage or nothing.","triggerScenarios":"A JSX opening element with an explicit literal `role` and at least one `aria-*` attribute that is neither in that role's supported-props list nor a global ARIA attribute. This default diagnostic is used when the role is explicitly set rather than implicit.","commonSituations":"Copy-pasted ARIA soup where every aria attribute is sprinkled on; changing a role without pruning its old aria props; components that forward all props including stale aria state; mixing widget attributes (`aria-checked`, `aria-selected`) onto container roles.","solutions":["Remove the unsupported `aria-*` attribute named in the message.","If the attribute is genuinely needed, the role is wrong — pick the role that supports your state (e.g. `option` for `aria-selected`).","Use global attributes (`aria-label`, `aria-hidden`) when you only need labelling/hiding."],"exampleFix":"// before\n<h1 role=\"heading\" aria-checked=\"true\">Title</h1>\n\n// after\n<h1 role=\"heading\" aria-level={1}>Title</h1>","handlingStrategy":"validation","validationCode":"npx oxlint --jsx-a11y/role-supports-aria-props src/","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When changing a role, prune aria-* props that belonged to the old role.","Consult the ARIA role support table before adding widget state attributes.","Keep aria usage minimal: only attributes the current role supports plus globals."],"tags":["jsx-a11y","react","accessibility","aria","aria-roles","lint"],"backgroundTag":"unsupported-aria-attribute-for-role","analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}