cvn / angular-shims-placeholder

Angular directive to emulate the placeholder attribute on text and password input fields for old browsers, such as IE9, IE8, and IE7. Also works on textareas and html5 input types.
MIT License
63 stars 26 forks source link

Focus doesn't work with password fields in IE9 #34

Open deopard opened 8 years ago

deopard commented 8 years ago

Since the plugin generates a text input for masking when polyfilling password input placeholder, focusing the original empty password input field won't be shown to the user.

cvn commented 8 years ago

Thanks for reporting this issue. I can't think of an elegant solution right now, but here's a workaround if it's useful for you. This relies on the internal implementation of angular-shims-placeholder, so it's kinda fragile, but it would work.

if (elem.hasClass('ng-hide')) {
    // handle focusing empty angular-shims-placeholder password inputs
    $(elem).prev('.empty').focus();
} else {
    $(elem).focus();
}