useIframeTitle (since v1.0.0)
Diagnostic Category: lint/a11y/useIframeTitle
Source: iframe-has-title
Enforces the usage of the attribute title
for the element iframe
.
Examples
Section titled ExamplesInvalid
Section titled Invalid <iframe />
a11y/useIframeTitle.js:1:2 lint/a11y/useIframeTitle ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Provide a title attribute when using iframe elements.
> 1 │ <iframe />
│ ^^^^^^^^^^
2 │
ℹ Screen readers rely on the title set on an iframe to describe the content being displayed.
<iframe></iframe>
a11y/useIframeTitle.js:1:1 lint/a11y/useIframeTitle ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Provide a title attribute when using iframe elements.
> 1 │ <iframe></iframe>
│ ^^^^^^^^
2 │
ℹ Screen readers rely on the title set on an iframe to describe the content being displayed.
<iframe title="" />
a11y/useIframeTitle.js:1:1 lint/a11y/useIframeTitle ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Provide a title attribute when using iframe elements.
> 1 │ <iframe title="" />
│ ^^^^^^^^^^^^^^^^^^^
2 │
ℹ Screen readers rely on the title set on an iframe to describe the content being displayed.
<iframe title={""} />
a11y/useIframeTitle.js:1:1 lint/a11y/useIframeTitle ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Provide a title attribute when using iframe elements.
> 1 │ <iframe title={""} />
│ ^^^^^^^^^^^^^^^^^^^^^
2 │
ℹ Screen readers rely on the title set on an iframe to describe the content being displayed.
<iframe title={undefined} />
a11y/useIframeTitle.js:1:1 lint/a11y/useIframeTitle ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Provide a title attribute when using iframe elements.
> 1 │ <iframe title={undefined} />
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │
ℹ Screen readers rely on the title set on an iframe to describe the content being displayed.
<iframe title={false} />
a11y/useIframeTitle.js:1:1 lint/a11y/useIframeTitle ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Provide a title attribute when using iframe elements.
> 1 │ <iframe title={false} />
│ ^^^^^^^^^^^^^^^^^^^^^^^^
2 │
ℹ Screen readers rely on the title set on an iframe to describe the content being displayed.
<iframe title={true} />
a11y/useIframeTitle.js:1:1 lint/a11y/useIframeTitle ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Provide a title attribute when using iframe elements.
> 1 │ <iframe title={true} />
│ ^^^^^^^^^^^^^^^^^^^^^^^
2 │
ℹ Screen readers rely on the title set on an iframe to describe the content being displayed.
<iframe title={42} />
a11y/useIframeTitle.js:1:1 lint/a11y/useIframeTitle ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Provide a title attribute when using iframe elements.
> 1 │ <iframe title={42} />
│ ^^^^^^^^^^^^^^^^^^^^^
2 │
ℹ Screen readers rely on the title set on an iframe to describe the content being displayed.
Valid
Section titled Valid<> <iframe title="This is a unique title" /> <iframe title={uniqueTitle} /> <iframe {...props} /></>