London | 26-ITP-Jan | Kris Oldrini | Sprint 2 | Form Controls#1140
London | 26-ITP-Jan | Kris Oldrini | Sprint 2 | Form Controls#1140XiaoQuark wants to merge 22 commits intoCodeYourFuture:mainfrom
Conversation
… text and email inputs
✅ Deploy Preview for cyf-onboarding-module ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
Form-Controls/index.html
Outdated
| <fieldset> | ||
| <legend>Colours</legend> | ||
| <!-- colours input, limit to 3 colours only --> | ||
| <p>Please select a colour *</p> |
There was a problem hiding this comment.
We can make this, <legend>Please select a colour *</legend>
Screen readers announce legends, not surrounding text.
There was a problem hiding this comment.
I will do that, thank you. I just have a question: does it mean that radio buttons should always be inside a fieldset? Because I don't think I can create a "group" label, only one for each input. Unless there's another trick I could not find.
There was a problem hiding this comment.
Good question 🙂
Radio buttons don’t strictly have to be inside a fieldset, but it’s considered best practice when they represent a group of related choices (like selecting one colour). The fieldset groups them semantically, and the legend acts as the label for the whole group, which helps screen readers understand the context.
Each radio button still has its own label, but the legend describes the question they all belong to.
So in cases like this, using a fieldset + legend is usually the most accessible approach, but it’s not required for the form to function.
Nice thinking about accessibility here 👍
Form-Controls/index.html
Outdated
| value="yellow" | ||
| /> | ||
| <label for="yellow">🟨 Yellow </label> | ||
| </p> |
There was a problem hiding this comment.
The <p> is not needed.
pattern like below is not needed,
<li>
<p>
<input>
<label>
</p>
</li>
we can have cleaner,
<li>
<input>
<label>
</li>
this goes to some places on top as well
There was a problem hiding this comment.
Absolutely agree. I wouldn't normally add a <p> inside a list item, but Lighthouse was not happy with the list's tiny spacing, and, because I could not use CSS, I tried to improvise.
So now I'm not sure if I can remove them.
Form-Controls/index.html
Outdated
| id="email" | ||
| name="customerEmail" | ||
| placeholder="jsmith@email.com" | ||
| pattern="^[\w.-]+@[\a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$" |
There was a problem hiding this comment.
\a is invalid inside character class
Browsers already validate emails using: type="email"
you can remove the pattern completely
<input type="email" ... required />
There was a problem hiding this comment.
Ops, that was a missed typo. I've corrected it now, thank you
There was a problem hiding this comment.
When you say remove the pattern do you mean for this specific sprint or in general?
There was a problem hiding this comment.
I meant in general for typical HTML forms when you’re using type="email", browsers already provide built-in validation that covers most real-world cases. Because of that, adding a custom pattern is often unnecessary unless you have a very specific requirement to restrict the format further.
In future projects, you might choose to add one if there’s a clear reason, but it’s worth thinking about what additional validation you actually need before doing so.
There was a problem hiding this comment.
Above are suggestions. Other than that this submission meets the expected learning outcomes for the exercise.
It demonstrates understanding of form structure and validation fundamentals, and shows readiness to continue progressing through the module. Nice work @XiaoQuark
…nd more descriptive and remove redundant <p>, as suggested by pull request comments
…Module-Onboarding into feature/form-controls
|
Hi, I was just wondering if your last comment means the pull request could be marked as complete or if I need to do more changes. Please let me know. Thank you |
…ad <br> for the spacing required by Lighthouse
…branch. Those changes were mistakenly imported from another branch
This comment has been minimized.
This comment has been minimized.
|
Thank you, I think I fixed it for now. |

Learners, PR Template
Self checklist
Changelist
This PR adds a semantic HTML form for ordering a t-shirt, following the given requirements.
Form Structure
Customer Information
T-shirt Options