-
-
Notifications
You must be signed in to change notification settings - Fork 417
London | 26-ITP-Jan | Kris Oldrini | Sprint 2 | Form Controls #1140
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?
Changes from all commits
9a38079
6641400
1f0a883
55610e9
b5a3bd0
f32d653
75b7ba6
f852b03
35e4fc6
21b47b9
43d3a77
4bf9e76
6247867
66a63ab
385841d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,114 @@ | ||
| <!DOCTYPE html> | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="utf-8" /> | ||
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
| <title>My form exercise</title> | ||
| <meta name="description" content="" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
| </head> | ||
| <body> | ||
| <header> | ||
| <h1>Product Pick</h1> | ||
| </header> | ||
| <main> | ||
| <form> | ||
| <!-- write your html here--> | ||
| <!-- | ||
| try writing out the requirements first as comments | ||
| this will also help you fill in your PR message later--> | ||
| </form> | ||
| </main> | ||
| <footer> | ||
| <!-- change to your name--> | ||
| <h2>By HOMEWORK SOLUTION</h2> | ||
| </footer> | ||
| </body> | ||
| <head> | ||
| <meta charset="utf-8" /> | ||
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
| <meta | ||
| name="description" | ||
| content="Accessible t-shirt order form with colour and size selection." | ||
| /> | ||
| <title>My form exercise</title> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
| </head> | ||
| <body> | ||
| <header> | ||
| <h1>T-shirt Picker</h1> | ||
| <p>Please complete all required (*) fields to complete order</p> | ||
| </header> | ||
| <main> | ||
| <form> | ||
| <fieldset> | ||
| <legend>Customer Info</legend> | ||
| <!-- name input, must be min 2 chars long --> | ||
| <p> | ||
| <label for="name"> Name *</label> | ||
| <input | ||
| type="text" | ||
| id="name" | ||
| name="customerName" | ||
| placeholder="Jane Smith" | ||
| minlength="2" | ||
| required | ||
| /> | ||
| </p> | ||
| <!-- email input, must be a valid email format --> | ||
| <p> | ||
| <label for="email"> Email *</label> | ||
| <input | ||
| type="email" | ||
| id="email" | ||
| name="customerEmail" | ||
| placeholder="jsmith@email.com" | ||
| pattern="^[\w.-]+@[\a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$" | ||
| required | ||
| /> | ||
| </p> | ||
| </fieldset> | ||
| <fieldset> | ||
| <legend>Colours</legend> | ||
| <!-- colours input, limit to 3 colours only --> | ||
| <p>Please select a colour *</p> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can make this, Screen readers announce legends, not surrounding text.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. |
||
| <ul> | ||
| <li> | ||
| <p> | ||
| <input | ||
| type="radio" | ||
| name="colours" | ||
| id="red" | ||
| value="red" | ||
| required | ||
| /> | ||
| <label for="red"> 🟥 Red </label> | ||
| </p> | ||
| </li> | ||
| <li> | ||
| <p> | ||
| <input | ||
| type="radio" | ||
| name="colours" | ||
| id="blue" | ||
| value="blue" | ||
| /> | ||
| <label for="blue">🟦 Blue </label> | ||
| </p> | ||
| </li> | ||
| <li> | ||
| <p> | ||
| <input | ||
| type="radio" | ||
| name="colours" | ||
| id="yellow" | ||
| value="yellow" | ||
| /> | ||
| <label for="yellow">🟨 Yellow </label> | ||
| </p> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The pattern like below is not needed, we can have cleaner, this goes to some places on top as well
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Absolutely agree. I wouldn't normally add a 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. |
||
| </li> | ||
| </ul> | ||
| </fieldset> | ||
| <fieldset> | ||
| <legend>Size</legend> | ||
| <p> | ||
| <!-- size input, limit to 6 sizes: XS, S, M, L, XL, XXL --> | ||
| <label for="size">Please select a size *</label> | ||
| <select name="size" id="size" required> | ||
| <option value="" disabled selected>size</option> | ||
| <option value="XS">XS</option> | ||
| <option value="S">S</option> | ||
| <option value="M">M</option> | ||
| <option value="L">L</option> | ||
| <option value="XL">XL</option> | ||
| <option value="XXL">XXL</option> | ||
| </select> | ||
| </p> | ||
| </fieldset> | ||
|
|
||
| <!-- submit button --> | ||
| <p><button type="submit">Confirm your order</button></p> | ||
| </form> | ||
| </main> | ||
| <footer> | ||
| <!-- change to your name--> | ||
| <h2>Kris Oldrini | CYF: Intro to Programming</h2> | ||
| </footer> | ||
| </body> | ||
| </html> | ||
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.
\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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ops, that was a missed typo. I've corrected it now, thank you
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.
When you say remove the pattern do you mean for this specific sprint or in general?