material-components / material-components/material-components-android

[TextInputLayout] End Clear Icon visibility not backward compatible

Open
#2,266 5 comments 5 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

bug Widget: TextField
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

**Description:**

I have `TextInputLayout`+`TextInputEditText` combo; `TextInputLayout` styled to `@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox` and `app:endIconMode="clear_text"`, while `TextInputEditText` has:

```xml
android:background="@null"
android:cursorVisible="false"
android:inputType="textNoSuggestions"
android:clickable="true"
android:focusable="false"
android:focusableInTouchMode="false"
```

The control is setup so that users can't directly entry text, the editText has a click listener that opens a drop-down or date-picker, that populates the editText once user have selected something. The end clear button should be visible to allow for clearing the data. This worked in `material-1.3.0`, the clear button is showing up even if the field is not focusable, but not longer shows up in `material-1.4.0-x`. There's a certain weirdness in 1.4.0-x as well, in that if the `focusable=false` then the clear button doesn't exist, but if `focusable=true` then it's clickable but alpha=0f, so not really visible to the human eye, even if it participates in the measure pass.

**Expected behavior:**

Would like the clear button to be visible and useable when the `TextInputEditText` is customised to work like a dropdown button. Would prefer not to use an actual button for this because the UX is weird, especially if user wants to clear the data, clear button is the obvious UX.

**Android API version:** 29

**Material Library version:** Reproducible on `material-1.4.0-rc01` and `material-1.4.0-beta01`, worked as normal in `material-1.3.0`.

**Device:** tested and shows up on API 25 onwards

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.