Material-components-android: [TextInputLayout] Hiding already hidden error causes helper text to be hidden

Created on 19 Aug 2019  路  9Comments  路  Source: material-components/material-components-android

Description: Calling TextInputLayout.setError(null) without checking TextInputLayout.getError() for null will cause the helper text to show only for a brief amount of time (< 1s) before disappearing again.

Expected behavior: Calling TextInputLayout.setError(null) consecutively is expected to only hide the error only and not the helper text as well.

Source code:

final TextInputLayout inputLayout = findViewById(R.id.input_email);
inputLayout.setHelperText("Email");
inputLayout.setError("Email required");
inputLayout.setError(null);
inputLayout.setError(null);

Android API version: 28

Material Library version: 1.1.0-alpha09

Device: Asus Zenfone Max Pro (M1)

bug

Most helpful comment

I have the same issue. Seems lake a bug to me. As for me -- should be reopened. I expect that currently displayed helper text is not affected by setting error to null in any way. Simply do nothing Don't even animate. It's not ok that the result of setting error to null is hiding currently displayed helper text. Material Library version: 1.1.0-beta01

All 9 comments

I had the same problem and I found as solution this one:

  • don't set the error to null but set helperText directly
    I did so in kotlin:
  • textInputLayoutPassword.error = null
    and i solved with:
  • textInputLayoutPassword.helperText = resources.getText(R.string.login_error_lower_length_password)

@AlessandroAgneti I haven't tried this yet, I will give it a try soon. ;)

I have the same issue. Seems lake a bug to me. As for me -- should be reopened. I expect that currently displayed helper text is not affected by setting error to null in any way. Simply do nothing Don't even animate. It's not ok that the result of setting error to null is hiding currently displayed helper text. Material Library version: 1.1.0-beta01

Let's hear what the team has for this as well.

Having this problem too, don't know how to solve it... Didn't get this part "textInputLayoutPassword.helperText = resources.getText(R.string.login_error_lower_length_password)"

I had the same problem and I found as solution this one:

  • don't set the error to null but set helperText directly
    I did so in kotlin:
  • textInputLayoutPassword.error = null
    and i solved with:
  • textInputLayoutPassword.helperText = resources.getText(R.string.login_error_lower_length_password)

Having the same problem. Any update on the same?

I've the same problem.
This is definitely a bug, I will take a look at this ASAP

Currently looking into this! Seems like it's something happening in the IndicatorViewController logic

@leticiarossi I've pushed a WIP PR (I know you were working on it but I had some free time, sorry)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jaychang0917 picture jaychang0917  路  3Comments

MrCreeper1008 picture MrCreeper1008  路  3Comments

TdevM picture TdevM  路  3Comments

magnusfernandes picture magnusfernandes  路  3Comments

JakeWharton picture JakeWharton  路  3Comments