Lint Rules

useAriaPropTypes (since v12.0.0)

Enforce that ARIA state and property values are valid.

Examples

Invalid

<span role="checkbox" aria-checked="test">some text</span>
nursery/useAriaPropTypes.js:1:23 lint/nursery/useAriaPropTypes ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   The value of the ARIA attribute aria-checked is not correct.
  
  > 1 │ <span role="checkbox" aria-checked="test">some text</span>
                         ^^^^^^^^^^^^^^^^^^^
    2 │ 
  
   The only supported value for the aria-checked property one of the following:
  
  - true
  - false
  - mixed
  
<span aria-labelledby="">some text</span>
nursery/useAriaPropTypes.js:1:7 lint/nursery/useAriaPropTypes ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   The value of the ARIA attribute aria-labelledby is not correct.
  
  > 1 │ <span aria-labelledby="">some text</span>
         ^^^^^^^^^^^^^^^^^^
    2 │ 
  
   The only supported value is text.
  
<span aria-valuemax="hey">some text</span>
nursery/useAriaPropTypes.js:1:7 lint/nursery/useAriaPropTypes ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   The value of the ARIA attribute aria-valuemax is not correct.
  
  > 1 │ <span aria-valuemax="hey">some text</span>
         ^^^^^^^^^^^^^^^^^^^
    2 │ 
  
   The only supported value is number.
  
<span aria-orientation="hey">some text</span>
nursery/useAriaPropTypes.js:1:7 lint/nursery/useAriaPropTypes ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   The value of the ARIA attribute aria-orientation is not correct.
  
  > 1 │ <span aria-orientation="hey">some text</span>
         ^^^^^^^^^^^^^^^^^^^^^^
    2 │ 
  
   The only supported value for the aria-orientation property is one of the following:
  
  - vertical
  - undefined
  - horizontal
  

Valid

<>
    <span role="checkbox" aria-checked={checked} >some text</span>
    <span aria-labelledby="fooId barId" >some text</span>
</>

Accessibility guidelines

Resources