Missing Properties for State Representation

Id MissingPropertiesforStateRepresentation
Summary State attributes such as expanded/collapsed or range values are not exposed
Severity Warning
Category Assistive Technologies / Semantic Roles and States
Affects Resource files and Kotlin and Java files
Implementation Custom lint rule – detect when interactive elements (e.g., View with clickable or checkable, or Composables with Modifier.clickable) do not propagate state information (isSelected, isChecked, isExpanded, error, etc.); has limitations for complex or dynamic states, so manual testing remains necessary to verify that state changes are correctly announced to assistive technologies.

Symptom

Interactive components lack proper semantic annotations for their current states (selected, error, expanded, etc.), missing semantics properties that communicate state information to assistive technologies.

Rationale

Prevents assistive technology users from understanding the current state of interactive elements, making it impossible to determine selection status, error conditions, or other critical state information needed for effective interaction and task completion.

Examples

XML Layout Example

<!-- Clickable item, but does not expose its selected state for accessibility tools -->
<TextView
    android:id="@+id/option"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Option"
    android:clickable="true" />
<!-- Missing: selected state (android:selected) for accessibility -->

Kotlin Code Example

val optionView = findViewById<TextView>(R.id.option_view)
var isSelected = false

optionView.setOnClickListener {
    isSelected = !isSelected
    // Only updates color visually, no accessibility announcement
    optionView.setBackgroundColor(if (isSelected) Color.BLUE else Color.GRAY)
    // Missing: accessibility state update (optionView.isSelected = isSelected)
}

GitHub issues under this tag