{"record":{"id":"8aa5c11f0b798709","repo":"oxc-project/oxc","slug":"elements-with-aria-roles-must-use-a-valid-non-abs","errorCode":null,"errorMessage":"Elements with ARIA roles must use a valid, non-abstract ARIA role.","messagePattern":"Elements with ARIA roles must use a valid, non-abstract ARIA role\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/jsx_a11y/aria_role.rs","lineNumber":20,"sourceCode":"    AstKind,\n    ast::{JSXAttributeItem, JSXAttributeValue, JSXExpression},\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\nuse schemars::JsonSchema;\nuse serde::Deserialize;\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    globals::{HTML_TAG, VALID_ARIA_ROLES},\n    rule::{DefaultRuleConfig, Rule},\n    utils::{get_element_type, get_prop_value, has_jsx_prop},\n};\n\nfn aria_role_diagnostic(span: Span, help_suffix: &str) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Elements with ARIA roles must use a valid, non-abstract ARIA role.\")\n        .with_help(format!(\n            \"Set a valid, non-abstract ARIA role for element with ARIA{help_suffix}\"\n        ))\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone, Deserialize)]\npub struct AriaRole(Box<AriaRoleConfig>);\n\n#[derive(Debug, Default, Clone, JsonSchema, Deserialize)]\n#[serde(rename_all = \"camelCase\", default, deny_unknown_fields)]\npub struct AriaRoleConfig {\n    /// Determines if developer-created components are checked.\n    #[serde(rename = \"ignoreNonDOM\")]\n    ignore_non_dom: bool,\n    /// Custom roles that should be allowed in addition to the ARIA spec.\n    allowed_invalid_roles: Vec<String>,\n}","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/jsx_a11y/aria_role.rs#L2-L38","documentation":"Fires from jsx-a11y/aria-role when an element's role attribute is not one of the valid, non-abstract ARIA roles (e.g. a typo or an abstract role like 'widget'). The helper appends a contextual help suffix describing valid roles and labels the attribute span.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/jsx_a11y/aria_role.rs:20 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a valid, non-abstract ARIA role name","Rely on the element's implicit role and remove the explicit `role` attribute"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}