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

[TextInputLayout] Prevents from Scrolling over the error (via setError())

Open
#2,435 8 comments 0 reactions 0 assignees 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 a `TextInputLayout` with an `TextInoutEditText` on top of my Fragments view, followed by more views, so I have to scroll and put that scrollable content within a `ScrollView`.

If I show an error using `setError()` on a `TextInputLayout`, I am no longer able to scroll over the `EditText` and let it scroll out of the `ScrollView`. I can't access all views below that `EditText` while there is an error displayed. That blocks the rest of my Fragment to be reached!

**Expected behavior:**
If there is a `TextInputLayout` with an error, it should always be possible to scroll over it.

**Source code:**

```



...
```
```
textInputLayoutReadingValue = view.findViewById(R.id.til_reading_value);
private void showInputError(String err) {
TextInputLayout textInputLayoutReadingValue = getTextInputLayoutReadingValue();
textInputLayoutReadingValue.setError(err);
}
```

**Android API version:**
Tested on API 28, 29 and 30

**Material Library version:**
com.google.android.material:material:1.4.0

**Device:**
Samsung Galaxy TAB 2 (Android 7.1.1)
(The error does not occur on a Samsung A9 (Android 10) for example.)

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.

Research direction

Reproduce the layout using ScrollView, TextInputLayout, TextInputEditText, and setError() on the API levels and Material Library version listed. Start at the TextInputLayout.setError() entry point and compare scrolling behavior with and without the error. Done means the content below the errored field remains reachable by scrolling.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.