Skip to content

Commit

Permalink
Fix validation message display in ValidatingForm (#135)
Browse files Browse the repository at this point in the history
- Use more specific class selectors to show invalid feedback only when
  form was validated and input is `:invalid`, similar to Bootstrap v5
  • Loading branch information
taesungh authored Dec 18, 2023
1 parent fe9d8f2 commit 2664368
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function VerificationForm() {
A login passphrase was sent to your email. Please enter
the passphrase.
</small>
<p className={clsx(styles.invalidated, "text-red-500")}>
<p className={clsx(styles.invalidFeedback, "text-red-500")}>
Sorry, that passphrase is invalid.
</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/site/src/app/login/components/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function LoginForm() {
UCI students will log in with UCI SSO. Please make sure
to use your school email address if you have one.
</small>
<p className={clsx(styles.invalidated, "text-red-500")}>
<p className={clsx(styles.invalidFeedback, "text-red-500")}>
Sorry, that email address is invalid.
</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.invalidFeedback {
display: none;
}

.validated {
&:invalid .invalidated {
:invalid ~ .invalidFeedback {
display: block;
}
}

.notYetValidated .invalidated {
display: none;
}

0 comments on commit 2664368

Please sign in to comment.