Skip to content

Commit

Permalink
[MaterialTimePicker][a11y] Fix label for hour/minute EditTexts.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 443080572
  • Loading branch information
paulfthomas authored and dsn5ft committed Apr 20, 2022
1 parent 6217aa8 commit 5b78bf4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Expand Up @@ -80,6 +80,8 @@ public ChipTextInputComboView(
addView(chip);
addView(textInputLayout);
label = findViewById(R.id.material_label);
editText.setId(ViewCompat.generateViewId());
ViewCompat.setLabelFor(label, editText.getId());
editText.setSaveEnabled(false);
editText.setLongClickable(false);
}
Expand Down
Expand Up @@ -17,7 +17,6 @@

<com.google.android.material.textfield.TextInputLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:errorIconDrawable="@null"
Expand All @@ -26,19 +25,15 @@
app:shapeAppearanceOverlay="@null">

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/material_timepicker_edit_text"
android:layout_width="96dp"
android:textCursorDrawable="@drawable/material_cursor_drawable"
android:layout_height="80dp"
android:paddingBottom="6dp"
tools:ignore="LabelFor" />
android:paddingBottom="6dp" />

<TextView
android:labelFor="@+id/material_timepicker_edit_text"
android:id="@+id/material_label"
android:focusable="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:ignore="LabelFor" />
android:layout_height="wrap_content" />

</com.google.android.material.textfield.TextInputLayout>

0 comments on commit 5b78bf4

Please sign in to comment.