// Toggle password visibility so users can check for typos, especially on mobile. document.querySelectorAll(".password-toggle").forEach(function (button) { button.addEventListener("pointerdown", function (event) { // Toggle on press (not click) for an instant response. preventScroll avoids // a scroll-to-input animation that makes rapid toggling feel laggy, and // keeping focus on the input keeps the mobile keyboard open. event.preventDefault(); var input = document.getElementById(button.getAttribute("data-toggle-for")); if (!input) return; var showing = input.type === "text"; input.type = showing ? "password" : "text"; button.textContent = showing ? "Show" : "Hide"; button.setAttribute("aria-label", showing ? "Show password" : "Hide password"); input.focus({ preventScroll: true }); }); });