oxc-project/oxc · error
This element does not support ARIA roles, states, or propert
Error message
This element does not support ARIA roles, states, or properties.
What it means
Fires from jsx-a11y/aria-unsupported-elements when a reserved/DOM element that cannot be exposed to accessibility tree (per the rule's element list, such as meta, html, script) is given a role or aria-* attribute. The helper interpolates the offending attribute name in the help text.
Source
Thrown at crates/oxc_linter/src/rules/jsx_a11y/aria_unsupported_elements.rs:50
/// ```
///
/// Examples of **correct** code for this rule:
/// ```jsx
/// <meta charset="UTF-8" />
/// ```
AriaUnsupportedElements,
jsx_a11y,
correctness,
fix,
version = "0.1.1",
short_description = "Enforces that reserved DOM elements do not contain ARIA roles, states, or properties.",
);
#[derive(Debug, Default, Clone)]
pub struct AriaUnsupportedElements;
fn aria_unsupported_elements_diagnostic(span: Span, attr_name: &str) -> OxcDiagnostic {
OxcDiagnostic::warn("This element does not support ARIA roles, states, or properties.")
.with_help(format!("Try removing the prop `{attr_name}`."))
.with_label(span)
}
impl Rule for AriaUnsupportedElements {
fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
if let AstKind::JSXOpeningElement(jsx_el) = node.kind() {
let el_type = get_element_type(ctx, jsx_el);
if RESERVED_HTML_TAG.contains(&el_type.as_ref()) {
for attr in &jsx_el.attributes {
let attr = match attr {
JSXAttributeItem::Attribute(attr) => attr,
JSXAttributeItem::SpreadAttribute(_) => continue,
};
let attr_name = get_jsx_attribute_name(&attr.name);
let attr_name = attr_name.cow_to_ascii_lowercase();
if attr_name == "role" || is_valid_aria_property(&attr_name) {
ctx.diagnostic_with_fix(View on GitHub (pinned to e1e7af627c)
Solutions
- Remove the `role`/`aria-*` attribute from the reserved element
- Move the ARIA attributes to an element that supports them
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/oxc_linter/src/rules/jsx_a11y/aria_unsupported_elements.rs:50 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20).
Data as JSON: /api/errors/740963a1c2291e41.
Report an issue: GitHub.