
<form action="" class="col s12" method="post" accept-charset="utf-8">
<div class="row">
<div class="input-field col s12" style="margin-bottom: 10px;">
<i class="mdi-action-account-circle prefix"></i>
<input type="text" name="identity" value="" class="validate" id="icon_prefix" required="required" style="margin-top: 0.5rem;" />
<label for="icon_prefix" style="margin-left: 3.5rem;" class="active">袧芯屑械褉 褌械谢械褎芯薪邪 懈谢懈 e-mail</label>
</div>
<div class="input-field col s12">
<i class="mdi-action-lock-outline prefix"></i>
<input type="password" name="password" value="" class="validate" id="icon_password" required="required" style="margin-top: 0.5rem;" />
<label for="icon_password" style="margin-left: 3.5rem;" class="active">袩邪褉芯谢褜</label>
</div>
<div class="input-field col s6">
<button class="btn cyan waves-effect waves-light right" type="submit" name="action"><i class="mdi-action-lock-open"></i> 袙芯泄褌懈</button>
</div>
</div>
</form>
Exactly the same problem here :

Solved by adding placeholder attribute to input.
materialize/js/forms.js
if ($(element).val().length > 0 || $(this).attr('placeholder') !== undefined || $(element)[0].validity.badInput === true) {
$(this).siblings('label').addClass('active');
}
I am not sure that placeholder checking for undefined is necessary.
If you wait until everything is rendered, can do soemthing like this,
$('input:-webkit-autofill').each(function(){
if ($(this).val().length !== "") {
$(this).siblings('label, i').addClass('active');
}
});
Same problem here.
In the login page.
I think this error occurs on all input password.
plz fix this. :)
I'm having the same issue
$('input:-webkit-autofill').each(function(){
if ($(this).val().length !== "") {
$(this).siblings('label, i').addClass('active');
}
});
The only solution that worked for me is adding to the input:
placeholder=" "
Is there a better fix?
Please check https://github.com/Dogfalo/materialize/issues/194
I've tried some solutions presented and none worked properly, when it works it's just in chrome, when I try on firefox the error still persists.
I do not think this should be closed if the error still does, right?
What would be the official solution to this problem?
Thanks for reopening.
I'd like to share some of the solutions I've put in place to try to help, with the ultimate solution.
The browsers I tested were the following: Chrome, Firefox, Safari, Edge.
input:-webkit-autofill { +label { @extend .active; } } }
input:-webkit-autofill {
&,
&:hover,
&:focus,
&:active {
-webkit-box-shadow: inset 0 0 0 500px white !important;
}
+label {
font-size: 0.8rem;
-webkit-transform: translateY(-140%);
transform: translateY(-140%);
}
}
input:placeholder-shown {
+label {
@extend .active;
}
}
$(':input').one('input', function () {
setTimeout($('input[type=password]:-webkit-autofill').siblings('label').addClass('active')}, 0);
});
```javascript
$("input[name=login]").on("change.autofill", function () {
$("[for=password]").addClass("active");
}).click(function() {
$(this).unbind("change.autofill");
});
```javascript
Template.myTemplateName.onRendered (function(){
Materialize.updateTextFields();
});
```javascript
$(window).load($.debounce(200,function(){
$('input:-webkit-autofill').each(function(){
if ($(this).val().length !== "") {
$(this).siblings('label, i').addClass('active');
}
});
}));
4. This solution is currently the one I'm using because it applies to 100% of browsers and does not present any strange behavior, but the effect is lost by keeping the text always active, so I do not consider this a defenitive solution:
```html
<input placeholder=" " type="email" id="user_email">
<label class="active" for="user_email">Email</label>
I hope that with this information I have helped to find a definitive solution, that works in all current browsers. (IE does not count)
PS: Thanks for all the hard work that all the developers given in materializecss, it's a great front-end framework.
This problem seems to have been fixed in recent versions of Chrome and Firefox
Broken in Chrome 65.0.3325.146 , Materialize 1.0.0-alpha.4
Fixed by adding:
```
input:-webkit-autofill + label {
-webkit-transform: translateY(-14px) scale(0.8);
transform: translateY(-14px) scale(0.8);
-webkit-transform-origin: 0 0;
transform-origin: 0 0;
}
@WhileLoop where did you added your code?
@WhileLoop finallyy!!! jaj thanks so much
Most helpful comment
Fixed by adding:
```
input:-webkit-autofill + label {
-webkit-transform: translateY(-14px) scale(0.8);
transform: translateY(-14px) scale(0.8);
-webkit-transform-origin: 0 0;
transform-origin: 0 0;
}