Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new PasswordInput component with a show/hide toggle across React, Angular, and Shadcn implementations, along with updated styles, translations, and tests. A critical issue was identified in the React PasswordInput component where the ref prop is not properly forwarded or merged, causing external refs to be overwritten and ignored.
russellwheatley
left a comment
There was a problem hiding this comment.
Thanks for this @demolaf, the a11y cleanup around the label is a nice improvement. A few inline comments below.
One general point: the markup and CSS selector change is breaking, but the title is feat(forms). Might be worth checking the release tooling treats it as breaking and not a minor. There's also a behaviour change that isn't listed under Breaking Changes: clicking the description or empty space in the field wrapper no longer focuses the input, since the wrapper isn't a <label> any more.
| const formElement = input?.form; | ||
| if (!input || !formElement) return; | ||
|
|
||
| const hide = () => { |
There was a problem hiding this comment.
This fires on every submit event, including when validation fails, so someone who revealed the password to fix a typo gets it hidden again before they can retype. It matches "hidden again on submit" in the description, so it might well be intended. Just flagging it in case it feels jarring in practice. Same applies to the Angular and shadcn versions.
There was a problem hiding this comment.
Intentional, it follows NIST guidance to show the password only until it is submitted.
|
One behavior change may be missing from Breaking Changes: previously, clicking the description or empty space in the field wrapper focused the input because the wrapper was a |
|
@russellwheatley thanks for the review.
|
|
@revmarcuspeter-cyber Intentional, it follows from moving the toggle and other controls out of the |
Closes #1505.
Adds a show/hide password toggle to
SignInAuthFormandSignUpAuthFormin React, Angular and shadcn. It is always on, with no opt-out.<div data-input-field>instead of<label>, with<label for>around the label text only. Custom CSS targeting.fui-form fieldset label inputneeds to target[data-input-field]instead.getByLabelText(/password/i)now also match the toggle, so use an exact label.<label>.Changes
aria-label("Show password" / "Hide password"). The newshowPasswordandhidePasswordlabels are translated in all 42 locales, and the toggle sits at the inline end so it works right to left.<label>any more. In the React and Angular components, descriptions and errors are linked to the input witharia-describedby.password-inputregistry component, and the shadcn example copies are updated.Preview
Sign in: reveal, hide, and hidden again on submit
password-toggle-sign-in.mp4
Sign up: same flow on the new-password field
password-toggle-sign-up.mp4