Created
November 27, 2024 16:37
-
-
Save prince-neres/7a2da30d4c2904cf299381beee0c76e0 to your computer and use it in GitHub Desktop.
Disable show password icon in browser autocomplete
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <style> | |
| #_com_liferay_login_web_portlet_LoginPortlet_password:-webkit-autofill { | |
| animation: autofill-detect 0.001s both; | |
| } | |
| @keyframes autofill-detect { | |
| from { | |
| background-color: #fff; | |
| } | |
| to { | |
| background-color: #fff; | |
| } | |
| } | |
| .disabled-eye { | |
| pointer-events: none; | |
| color: gray; | |
| } | |
| </style> | |
| <script> | |
| document.addEventListener("animationstart", (event) => { | |
| if (event.animationName === "autofill-detect") { | |
| const passwordInput = event.target; | |
| let showPasswordIcon = passwordInput.parentElement.querySelector(".icon-eye-close"); | |
| if (!showPasswordIcon) { | |
| passwordInput.type = "password"; | |
| showPasswordIcon = passwordInput.parentElement.querySelector(".icon-eye-open"); | |
| showPasswordIcon.classList.remove("icon-eye-open"); | |
| showPasswordIcon.classList.add("icon-eye-close"); | |
| } | |
| showPasswordIcon.style.pointerEvents = "none"; | |
| showPasswordIcon.classList.add("disabled-eye"); | |
| } | |
| }); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment