Hint Not Announced in Prefilled Fields

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.

Symptom

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.

Rationale

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.

Examples

XML Layout Example

<!-- 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>

Kotlin Code Example

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
    }
}

GitHub issues under this tag