Repository navigation
Teach forms with contact validation - #39
Merged
Merged
Conversation
gpbsumido
marked this pull request as ready for review
November 21, 2026 15:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Eighth lesson in my Angular guide: forms. The feature slice fixes the contact form's validation.
What shipped
Blank messages are rejected. A name or message of only whitespace used to pass
Validators.required. AnotBlankvalidator inshared/validators.tsnow rejects it.Send explains instead of greying out. The button is enabled except while sending. Pressing it on an invalid form runs
markAllAsTouched()and moves focus to the first invalid field.Accessible errors.
aria-invalidandaria-describedbywhile the error shows.role="status"region that is always in the DOM.autocompletehints, and the form usesnovalidateso Angular is the only validator.Lesson 08: forms (
/thoughts/angular-08-forms)ControlValueAccessor@angular/forms21.2)FormArrayof links, with the status and raw value shown live.Version and changelog. 1.4.7, with a matching changelog entry.
Commits
Verification
aria-invalidrole="status"rather than a role on the message itself, because a region that appears already holding text often isn't announced.ng test: 59 files, 418 tests, exit 0, including axe on the contact form with every error showing.tsc --noEmitconfigs are clean.INVALID.Known gap, not in this PR
The contact form's submit is still simulated: a
setTimeoutreports "Message sent successfully!" without sending anything. That predates this PR and needs a real endpoint. I've kept it out of scope here.TO-DOs for this PR