| Id | HintNotAnnouncedinPrefilledFields |
| Summary | Screen readers skip hint text when inputs are prefilled, reducing clarity |
| Severity | Informational |
| Category | Assistive Technologies / Labels and Associations |
| Affects | Resource files and Kotlin and Java files |
| Implementation |
Custom lint rule with informational severity - flags EditText with
both android:hint and android:text for
manual accessibility review to ensure hint information is accessible.
|
EditText fields with prefilled values do not announce their hints to screen readers, preventing assistive technology users from accessing important guidance like format instructions or field expectations.
Prevents screen reader users from understanding the purpose or expected format of prefilled EditText fields, as they cannot access hint information that explains what the field is for or what type of input is expected, creating confusion during form interaction.
<!-- Input field with prefilled value that hides hint -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- Email field with existing value hiding format hint -->
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter email address"
android:text="user@example.com"
android:inputType="textEmailAddress" />
</LinearLayout>
class PrefilledFormActivity : AppCompatActivity() {
private fun setupPrefilledFields() {
val emailField = findViewById<EditText>(R.id.email_field)
// Setting prefilled value that hides hint information
emailField.hint = "Enter work email address"
emailField.setText("john.doe@company.com") // Format hint hidden
// Missing: Alternative way to provide hint information
// Missing: contentDescription that includes hint context
}
}