BEFOREHard to use with keyboard / screen readers
Problems: unlabeled eye icon, requirements announced constantly, and no caps-lock warning.
AFTERAccessible show/hide + non-spammy feedback
Improvements: real button toggle (aria-pressed), caps-lock warning, and requirements are shown visually but only announced at sensible times.
Why this matters
- Unlabeled “eye” icons are invisible to screen reader users and often unreachable via keyboard.
- Requirements that update with
aria-liveon every keypress can be overwhelming. - Changing
type=password↔type=textcan accidentally move focus or lose cursor position if done carelessly.
Practical checklist: Password fields note.