oxc-project/oxc · error
Missing `title` attribute for the `iframe` element.
Error message
Missing `title` attribute for the `iframe` element.
What it means
Raised by jsx-a11y/iframe-has-title when an <iframe> element lacks a title attribute. Screen readers announce the title to describe the iframe's content; without it users of assistive technology cannot know its purpose.
Source
Thrown at crates/oxc_linter/src/rules/jsx_a11y/iframe_has_title.rs:17
use oxc_ast::{
AstKind,
ast::{JSXAttributeValue, JSXExpression},
};
use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::{GetSpan, Span};
use crate::{
AstNode,
context::LintContext,
rule::Rule,
utils::{get_element_type, get_prop_value, has_jsx_prop_ignore_case},
};
fn iframe_has_title_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Missing `title` attribute for the `iframe` element.")
.with_help("Provide `title` property for `iframe` element.")
.with_label(span)
}
#[derive(Debug, Default, Clone)]
pub struct IframeHasTitle;
declare_oxc_lint!(
/// ### What it does
///
/// Enforce iframe elements have a title attribute.
///
/// ### Why is this bad?
///
/// Screen reader users rely on a iframe title to describe the contents of
/// the iframe. Navigating through iframe and iframe elements quickly
/// becomes difficult and confusing for users of this technology if the
/// markup does not contain a title attribute.View on GitHub (pinned to e1e7af627c)
Solutions
- Add a descriptive title attribute to the iframe, e.g. <iframe title="Embedded video player" />.
- For iframes with no meaningful content, title them as decorative (e.g. title="Advertisement").
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/oxc_linter/src/rules/jsx_a11y/iframe_has_title.rs:17 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/d4b168a7c98d23fa.
Report an issue: GitHub.