-
Notifications
You must be signed in to change notification settings - Fork 85
feat(slash): update the component pass/passinput to have a default type #1380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
| expect(toggleButton.querySelector("i")).toHaveClass("glyphicon-eye-open"); | ||
|
|
||
| // Act: Click to toggle to text | ||
| fireEvent.click(toggleButton); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
il serait préférable d'utiliser userEvent au lieu de fireEvent
| "af-form__pass", | ||
| ); | ||
|
|
||
| const [type, setType] = useState<"text" | "password">("password"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
il serait préférable d'utiliser une ref pour changer à la voler le type de l'input dans devoir faire un re render du composant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on a besoin d'un rerender pour l'icone au bout du champ je pense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pas forcement via la ref tu l'input on peux changer le type sans devoir faire de rerender react.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
je pense que tu n'as pas saisi mon commentaire :
On a une icone qui dépend du type de l'input. En text on a une icone d'oeil barré, et en password une icone d'oeil ouvert.
Si tu ne rerender pas, ca ne sera pas mis a jour.
| onToggleType={() => | ||
| setType(type === "password" ? "text" : "password") | ||
| } | ||
| onToggleType={() => {}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ca ne serait pas plus simple de supprimer la props onToggleType ou de la rendre facultatif ?
| type={type} | ||
| ref={inputRef} | ||
| required={classModifier?.includes("required")} | ||
| aria-label={inputProps["aria-label"] || "password"} // Fallback to ensure accessibility |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoir un aria-label password ne me semble pas idéal



Closes #1086