Skip to content

Latest commit

 

History

History
34 lines (22 loc) · 1.29 KB

has-valid-accessibility-states.md

File metadata and controls

34 lines (22 loc) · 1.29 KB

has-valid-accessibility-states

Note: accessibilityRole and accessibilityStates are meant to be a cross-platform solution to replace accessibilityTraits and accessibilityComponentType, which will soon be deprecated. When possible, use accessibilityRole and accessibilityStates instead of accessibilityTraits and accessibilityComponentType.

The accessibilityStates property is used to tell Talkback or Voiceover the state a UI Element is in.

This property takes on an Array containing one, both, or neither of the following values

  • "selected": Used when the element is in a selected state. For example, a button is selected.
  • "disabled": Used when the element is disabled and cannot be interacted with

References

  1. React Native Docs - accessibilityStates

Rule details

This rule takes no arguments.

Succeed

<TouchableOpacity accessibilityStates={["selected"]} />
<TouchableOpacity accessibilityStates={["disabled"]} />
<TouchableOpacity accessibilityStates={["selected", "disabled"]} />
<TouchableOpacity accessibilityStates={[]} />
<TouchableOpacity accessibilityStates={[""]} />

Fail

<TouchableOpacity accessibilityStates="highlighted" />