{"record":{"id":"7e6ab854c01686bd","repo":"oxc-project/oxc","slug":"prop-name-is-not-a-valid-aria-attribute","errorCode":null,"errorMessage":"'{prop_name}' is not a valid ARIA attribute.","messagePattern":"'(.+?)' is not a valid ARIA attribute\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/jsx_a11y/aria_props.rs","lineNumber":16,"sourceCode":"use cow_utils::CowUtils;\nuse oxc_ast::AstKind;\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    globals::is_valid_aria_property,\n    rule::Rule,\n    utils::{get_jsx_attribute_name, starts_with_ignore_case},\n};\n\nfn aria_props_diagnostic(span: Span, prop_name: &str, suggestion: Option<&str>) -> OxcDiagnostic {\n    let mut err = OxcDiagnostic::warn(format!(\"'{prop_name}' is not a valid ARIA attribute.\"));\n\n    if let Some(suggestion) = suggestion {\n        err = err.with_help(format!(\"Did you mean '{suggestion}'?\"));\n    } else {\n        err = err.with_help(\"You can find a list of valid ARIA attributes at https://www.w3.org/TR/wai-aria-1.1/#state_prop_def\");\n    }\n\n    err.with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct AriaProps;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Enforces that elements do not use invalid ARIA attributes.\n    ///","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/jsx_a11y/aria_props.rs#L1-L34","documentation":"Diagnostic from oxlint's jsx-a11y aria-props rule. Any JSX attribute whose name starts with `aria-` must be one of the WAI-ARIA 1.1 states/properties; otherwise this diagnostic fires with the offending prop name. ARIA attributes are mostly typos (aria-labeledby for aria-labelledby, aria-activedescendant misspellings), and browsers plus assistive tech silently ignore invalid ones, so the accessible behavior you think you added does not exist. When a close match exists the help text suggests it, otherwise it links the W3C list.","triggerScenarios":"A JSX attribute name beginning with `aria-` that is not in the valid-ARIA set checked via `is_valid_aria_property` — e.g. `<div aria-labeledby=\"title\" />`, `<button aria-pressedd />`, `<input aria-decribedby=\"x\" />`. Suggestion logic uses case-insensitive prefix matching, so `aria-LabeledBy`-style mistakes get a 'Did you mean' hint.","commonSituations":"Misspelled aria-labelledby/aria-describedby (the most duplicated props in codebases); copy-paste from bad blog examples; kebab/camel confusion with the React DOM property names (`aria-labelledBy`); custom `aria-*` data props invented for other libraries.","solutions":["Apply the suggested fix from the help text if present (e.g. aria-labeledby → aria-labelledby).","Check the name against the W3C list linked in the help text (w3.org/TR/wai-aria-1-1/#state_prop_def).","If the attribute belongs to a third-party component library rather than real ARIA, rename it or disable the rule for that line."],"exampleFix":"// before\n<div aria-labeledby=\"section-title\" />\n\n// after\n<div aria-labelledby=\"section-title\" />","handlingStrategy":"validation","validationCode":"oxlint --jsx-a11y-plugin src/ # aria-props flags unknown aria-* attributes","typeGuard":"// if generating aria props dynamically, filter to the known set\nconst VALID_ARIA = new Set(['aria-label', 'aria-labelledby', /* ... */]);\nconst safeAria = (props: Record<string, unknown>) =>\n  Object.fromEntries(Object.entries(props).filter(([k]) => !k.startsWith('aria-') || VALID_ARIA.has(k)));","tryCatchPattern":null,"preventionTips":["Memorize the two most-misspelled: aria-labelledby (double-l) and aria-describedby.","Let the rule's 'Did you mean' suggestion drive the fix instead of guessing.","Do not invent aria-* attributes for app logic; prefix custom props differently."],"tags":["jsx-a11y","aria","accessibility","typo","oxlint","lint"],"backgroundTag":"invalid-aria-attribute","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"}