Skip to content
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

Pressing enter to submit the Super Admin creation form in the Setup Wizard and show form validation error #11465 #11500

Merged
merged 2 commits into from
Nov 24, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions kolibri/core/assets/src/views/userAccounts/PasswordTextbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,14 @@
this.$refs.password.focus();
},
checkErrorsAndSubmit(e) {
if (this.valid) {
this.$emit('submitNewPassword');
} else {
// Blurring will cause validation errors to show if needed
e.target.blur();
if (e.key === 'Enter') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand this. If checkErrorsAndSubmit is triggered by the the @keydown.enter="checkErrorsAndSubmit" event handler, why do you need to check in the event key is 'Enter'? https://vuejs.org/guide/essentials/event-handling.html#key-modifiers

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, you're right. It was a mistake. I will fix it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jredrejo I have corrected it.

if (this.valid) {
this.$emit('submitNewPassword');
} else {
// Blurring will cause validation errors to show if needed
this.confirmationBlurred = true;
e.preventDefault(); // Prevent the default form submission
}
}
},
},
Expand Down
Loading