useIframeTitle
诊断类别:lint/a11y/useIframeTitle
¥Diagnostic Category: lint/a11y/useIframeTitle
自从:v1.0.0
¥Since: v1.0.0
来源:
¥Sources:
-
与以下相同:
jsx-a11y/iframe-has-title
¥Same as:
jsx-a11y/iframe-has-title
强制对元素 iframe
使用属性 title
。
¥Enforces the usage of the attribute title
for the element iframe
.
¥Examples
¥Invalid
<iframe />
code-block.jsx: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>
code-block.jsx: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="" />
code-block.jsx: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={""} />
code-block.jsx: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} />
code-block.jsx: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} />
code-block.jsx: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} />
code-block.jsx: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} />
code-block.jsx: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
<> <iframe title="This is a unique title" /> <iframe title={uniqueTitle} /> <iframe {...props} /></>
可访问性指南
Section titled 可访问性指南¥Accessibility guidelines
¥Related links