Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

react ally role Rule

t-ligu edited this page Sep 20, 2016 · 2 revisions

react-a11y-role

Elements with aria roles must use a valid, non-abstract aria role. A reference to role defintions can be found at WAI-ARIA roles.

References

Rule options

This rule takes no arguments.

Examples

Bad

<div role='datepicker'></div>           <!-- Bad: 'datepicker' is not an aria role -->
<div role='range'></div>                <!-- Bad: 'range' is an abstract aria role -->

// An empty role is not allowed.
<div role ></div>
<div role=''></div>
<div role={}></div>
<div role={ '' }></div>

Good

<div></div>                   <!-- Good: no aria role -->
<div role='button'></div>     <!-- Good: 'button' is a valid aria role -->
<div role={ role }></div>     <!-- Good: role is a variable & cannot be determined until runtime -->