LP1977554 - Add Password visibility toggle on login screens
[evergreen-equinox.git] / Open-ILS / src / templates-bootstrap / opac / parts / base.tt2
index 0e8d2b1..b1edba6 100755 (executable)
                 let input = document.getElementById('password_field');
                 let icon = btn.querySelector('i');
                 btn.addEventListener('click', () => {
-                    input.type == 'password' ? [input.type = 'text', icon.setAttribute('class','fas fa-eye')] : [input.type = 'password', icon.setAttribute('class', 'fas fa-eye-slash')];
+                    if(input.type == 'password'){
+                        input.type = 'text';
+                        icon.setAttribute('class', 'fas fa-eye');
+                        btn.setAttribute('aria-checked', 'true');
+                        input.setAttribute('aria-description', 'Your password is visible!');
+                    }else {
+                        input.type = 'password';
+                        icon.setAttribute('class', 'fas fa-eye-slash');
+                        btn.setAttribute('aria-checked', 'false');
+                        input.setAttribute('aria-description', 'Your password is not visible.');
+                    }
                     input.focus();
                 });
                 let loginForm = document.getElementById('login_form');