Lint Rules

useIframeTitle (since v12.0.0)

Enforces the usage of the attribute title for the element iframe

Examples

Invalid

    <iframe />
nursery/useIframeTitle.js:1:5 lint/nursery/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>
nursery/useIframeTitle.js:1:5 lint/nursery/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="" />
nursery/useIframeTitle.js:1:5 lint/nursery/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={""} />
nursery/useIframeTitle.js:1:5 lint/nursery/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={<span className={"token string"}></span>}></iframe>
nursery/useIframeTitle.js:1:5 lint/nursery/useIframeTitle ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   Provide a title attribute when using iframe elements.
  
  > 1 │     <iframe title={<span className={"token string"}></span>}></iframe>
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    2 │ 
  
   Screen readers rely on the title set on an iframe to describe the content being displayed.
  
    <iframe title={undefined} />
nursery/useIframeTitle.js:1:5 lint/nursery/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} />
nursery/useIframeTitle.js:1:5 lint/nursery/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} />
nursery/useIframeTitle.js:1:5 lint/nursery/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} />
nursery/useIframeTitle.js:1:5 lint/nursery/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} />
    </>

Accessibility guidelines

WCAG 2.4.1 WCAG 4.1.2