src/content/docs/linter/rules/use-iframe-title.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="JSX and TSX" icon="seti:javascript"> ## Summary - Rule available since: `v1.0.0` - Diagnostic Category: [`lint/a11y/useIframeTitle`](/reference/diagnostics#diagnostic-category) - This rule is **recommended**, meaning it is enabled by default. - This rule doesn't have a fix. - The default severity of this rule is [**error**](/reference/diagnostics#error). - Sources: - Same as [`jsx-a11y/iframe-has-title`](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/iframe-has-title.md){
"linter": {
"rules": {
"a11y": {
"useIframeTitle": "error"
}
}
}
}
Enforces the usage of the attribute title for the element iframe.
<iframe />
<iframe></iframe>
<iframe title="" />
<iframe title={""} />
<iframe title={undefined} />
<iframe title={false} />
<iframe title={true} />
<iframe title={42} />
<>
<iframe title="This is a unique title" />
<iframe title={uniqueTitle} />
<iframe {...props} />
</>
{
"linter": {
"rules": {
"a11y": {
"useIframeTitle": "error"
}
}
}
}
Enforces the usage of the attribute title for the element iframe.
:::note
In .html files, this rule matches iframe elements case-insensitively (e.g., <IFRAME>, <IFrame>).
In component-based frameworks (Vue, Svelte, Astro), only lowercase <iframe> is checked. PascalCase variants like <Iframe> are assumed to be custom components and are ignored.
:::
<iframe></iframe>
<iframe title=""></iframe>
<iframe title="title"></iframe>