material-components / material-components/material-components-android
[TextInputLayout] Better support/design/documentation for clearing a dropdown menu
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
TLDR: I want to keep the AutoComplete behavior of dropdown menus but I also want the user to be able to clear the dropdown menu.
Exposed Dropdown Menus are now implemented using an `AutoCompleteTextView` as a direct child of `TextInputLayout`. This works fine for empty forms that are yet to be filled by users but I came across a pretty (in my opinion) common UI flow that is not yet fully supported.
When editing a form, a dropdown menu is (normally) already pre-selected with the previously selected choice of the user. In that case you want to clear the selection and select a different item from the adapter.
With the current implementation this isn't possible without the user completely deleting every single character by hand. Or you need to build custom behavior by dynamically changing the `endIconMode` between `END_ICON_CLEAR_TEXT` and `END_ICON_DROPDOWN_MENU` and even then it causes all sorts of problems.
The documentation states:
> Note: In order to have a non editable variation of the menu, you should disable user input in the AutoCompleteTextView. That can be achieved by setting android:editable="false" on the AutoCompleteTextView.
Besides using a deprecated attribute (why?) this also doesn't seem to have a non-XML alternative. So this desired behavior cannot be cleanly enabled or disabled dynamically and also does not help provide a solution to the problem I described above.
**Describe the solution you'd like**
A new endIcon mode like `TextInputLayout.END_ICON_DROPDOWN_MENU_CLEAR_TEXT` seems sufficient but the official designs specs don't explain how this would work visually.
Material design specs need to be appended to explain how **editing** or **clearing** an Exposed Dropdown Menu should work. This would better support the common flow of editing forms that are pre-loaded with previously inserted user data.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Start by reviewing the Exposed Dropdown Menu documentation, AutoCompleteTextView behavior, and the referenced Material design specifications; define the editing and clearing interaction and whether a new end-icon mode is required, with updated specifications and documentation as the completion criteria.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- design, documentation
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100