-
Notifications
You must be signed in to change notification settings - Fork 142
feat: add param to clear input after password prompt error #364
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
🦋 Changeset detectedLatest commit: 8671c5f The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
im thinking it may make more sense to call it if a prompt has a default value, i'd expect |
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.
Awesome work @kajoseph, thank you for taking the time on working on this. I left a small suggestion to make the changeset a bit clearer and concise.
"@clack/core": minor | ||
--- | ||
|
||
Add input reset to password prompt |
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.
Add input reset to password prompt | |
Add `clearOnError` option to password prompt to automatically clear input when validation fails |
This PR adds a
clearOnError
option to the password prompt to enforce typing the whole password again on an error. This is particularly useful whenmask: ''
(i.e. a hidden input) is given.e.g. Consider this case
If the user enters "password" and hits return, an (expected) error `Password must be "test123" will appear, like so:

The user then enters "test123" and hits return. They will get the same error because the value is actually "passwordtest123" which is not apparent with a hidden input.
This PR adds a "clearOnError" boolean option to have the input clear out after an error to avoid the confusion above.