Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input field active label toggle does not work when placeholder set to empty string #5717

Open
epanfile opened this issue Mar 5, 2018 · 0 comments

Comments

@epanfile
Copy link

epanfile commented Mar 5, 2018

  • Materialize Release: 1.0.0-alpha.3
  • Chrome Version 64.0.3282.140 (Official Build) (64-bit)
  • Windows 10 desktop

In utility function M.updateTextFields when setting label to active, placeholder is checked for null, which causes unpredictable input field animations if placeholder is undefined or empty string. Similarly, in the on blur event on input fields placeholder is checked just for null. The following lines of code are problematic:

if (element.value.length > 0 || $(element).is(':focus') || element.autofocus || $this.attr('placeholder') !== null) { $this.siblings('label').addClass('active'); }

and

if ($inputElement[0].value.length === 0 && $inputElement[0].validity.badInput !== true && $inputElement.attr('placeholder') === null) { selector += ", label"; }

Can you please look into adding a more complete verification for "empty" placeholder?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant