Add reusable PasswordInput component with visibility toggle#200
Open
jonathangreen wants to merge 1 commit intomainfrom
Open
Add reusable PasswordInput component with visibility toggle#200jonathangreen wants to merge 1 commit intomainfrom
jonathangreen wants to merge 1 commit intomainfrom
Conversation
7d634da to
a03088c
Compare
2 tasks
Extract a PasswordInput component that wraps a standard input with a show/hide toggle button using VisibleIcon/HiddenIcon. Use it in DebugAuthentication to let admins reveal the password when needed.
a03088c to
51b6763
Compare
tdilauro
approved these changes
Feb 28, 2026
Contributor
tdilauro
left a comment
There was a problem hiding this comment.
Looks good! 🙈
One suggestion below.
Comment on lines
+106
to
+131
| .password-input-wrapper { | ||
| position: relative; | ||
|
|
||
| input { | ||
| padding-right: 40px; | ||
| } | ||
|
|
||
| .password-toggle-btn { | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| position: absolute; | ||
| top: 50%; | ||
| right: 6px; | ||
| background: none; | ||
| border: none; | ||
| padding: 4px; | ||
| cursor: pointer; | ||
| transform: translateY(-50%); | ||
|
|
||
| svg { | ||
| width: 20px; | ||
| height: auto; | ||
| } | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
Suggestion - Since PasswordInput is meant to be reusable, this should stand on its own, too, so that the control will get styled properly when used elsewhere.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add a reusable
PasswordInputcomponent that wraps a standard<input>with a show/hide toggle button using the existingVisibleIconandHiddenIconSVGs. The component manages its own visibility state internally and forwards all standard input props viaReact.forwardRef.Use
PasswordInputinDebugAuthenticationso admins can reveal the patron password field when needed. Add supporting styles for the toggle button positioned inside the input.Motivation and Context
Code review feedback on the debug authentication feature requested using
type="password"for the password input (already done) and adding a way for users to reveal the password. Since there are multiple password fields in the app (DebugAuthentication, ChangePasswordForm) and more may come, a reusable component avoids duplicating toggle logic.How Has This Been Tested?
npm run test-jest-file tests/jest/components/PasswordInput.test.tsx— 5 tests pass (default type, toggle behavior, aria-labels, prop passthrough, wrapper class)npm run test-jest-file tests/jest/components/DebugAuthentication.test.tsx— 9 existing tests continue to passChecklist: