fix(curriculum): replace asterisks with "(required)" for accessibility (#56725)

This commit is contained in:
Shiva Sai
2024-10-17 18:20:59 +00:00
committed by GitHub
parent 228e73af06
commit 43661cf867
27 changed files with 80 additions and 80 deletions
@@ -16,7 +16,7 @@ In the previous lecture videos, you learned how to associate a `label` element w
The `for` attribute on the `label` element should match the `id` attribute on the `input` element. This is known as an explicit association.
Below your `legend` element, add a `label` element with the text of `Name*:`. For the `for` attribute, set it to the value of `"full-name"`.
Below your `legend` element, add a `label` element with the text of `Name (required):`. For the `for` attribute, set it to the value of `"full-name"`.
Then below your `legend` element, add an `input` element with no attributes. In the next steps, you will add the necessary attributes.
@@ -47,11 +47,11 @@ const label = document.querySelector('fieldset label');
assert.strictEqual(label.getAttribute('for'), 'full-name');
```
Your `label` element should have the text of `Name*:`.
Your `label` element should have the text of `Name (required):`.
```js
const label = document.querySelector('fieldset label');
assert.strictEqual(label.innerText, 'Name*:');
assert.strictEqual(label.innerText, 'Name (required):');
```
You should have an `input` element.
@@ -70,7 +70,7 @@ assert.strictEqual(input.getAttribute('id'), 'full-name');
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
--fcc-editable-region--
<input>
--fcc-editable-region--
@@ -61,7 +61,7 @@ assert.strictEqual(input.getAttribute('name'), 'name');
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
--fcc-editable-region--
<input type="text" id="full-name">
--fcc-editable-region--
@@ -60,7 +60,7 @@ assert.isNotNull(document.querySelector('fieldset input[required]'));
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
--fcc-editable-region--
<input type="text" id="full-name" name="name">
--fcc-editable-region--
@@ -9,7 +9,7 @@ dashedName: step-13
Your hotel feedback form should also collect an email address from the user.
Start by adding a new `label` element with the text `Email address*:` to the form. Your `label` element should have a `for` attribute set to the value of `"email"`.
Start by adding a new `label` element with the text `Email address (required):` to the form. Your `label` element should have a `for` attribute set to the value of `"email"`.
# --hints--
@@ -19,10 +19,10 @@ You should have a `label` element.
assert.strictEqual(document.querySelectorAll('fieldset label').length, 2);
```
Your `label` element should have the text `Email*:`.
Your `label` element should have the text `Email address (required):`.
```js
assert.strictEqual(document.querySelector('fieldset label:nth-of-type(2)').innerText, 'Email address*:');
assert.strictEqual(document.querySelector('fieldset label:nth-of-type(2)').innerText, 'Email address (required):');
```
Your `label` element should have a `for` attribute set to the value of `"email"`.
@@ -54,7 +54,7 @@ assert.strictEqual(document.querySelector('fieldset label[for="email"]').getAttr
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
--fcc-editable-region--
@@ -74,10 +74,10 @@ assert.strictEqual(document.querySelector('input#email').getAttribute('placehold
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
--fcc-editable-region--
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
--fcc-editable-region--
</fieldset>
@@ -9,7 +9,7 @@ dashedName: step-15
Your hotel feedback form should have an option for users to add their age.
Start by adding a `label` element with the text `Age(optional):` to the form.
Start by adding a `label` element with the text `Age (optional):` to the form.
The `for` attribute should be set to `"age"`.
@@ -27,10 +27,10 @@ Your `label` element should have a `for` attribute set to `"age"`.
assert.isNotNull(document.querySelector('label[for="age"]'));
```
You `label` element should have the text `Age(optional):`.
You `label` element should have the text `Age (optional):`.
```js
assert.strictEqual(document.querySelector('label[for="age"]').textContent, "Age(optional):");
assert.strictEqual(document.querySelector('label[for="age"]').textContent, "Age (optional):");
```
# --seed--
@@ -56,10 +56,10 @@ assert.strictEqual(document.querySelector('label[for="age"]').textContent, "Age(
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
<input
placeholder="example@email.com"
required
@@ -76,10 +76,10 @@ assert.isNotNull(document.querySelector('input[max="100"]'));
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
<input
placeholder="example@email.com"
required
@@ -88,7 +88,7 @@ assert.isNotNull(document.querySelector('input[max="100"]'));
name="email"
/>
--fcc-editable-region--
<label for="age">Age(optional):</label>
<label for="age">Age (optional):</label>
--fcc-editable-region--
</fieldset>
@@ -56,10 +56,10 @@ assert.strictEqual(document.querySelectorAll('legend')[1].textContent, 'Was this
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
<input
placeholder="example@email.com"
required
@@ -67,7 +67,7 @@ assert.strictEqual(document.querySelectorAll('legend')[1].textContent, 'Was this
type="email"
name="email"
/>
<label for="age">Age(optional):</label>
<label for="age">Age (optional):</label>
<input type="number" name="age" id="age" min="3" max="100" />
</fieldset>
--fcc-editable-region--
@@ -85,10 +85,10 @@ assert.strictEqual(document.querySelector('fieldset:nth-of-type(2) input[type="r
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
<input
placeholder="example@email.com"
required
@@ -96,7 +96,7 @@ assert.strictEqual(document.querySelector('fieldset:nth-of-type(2) input[type="r
type="email"
name="email"
/>
<label for="age">Age(optional):</label>
<label for="age">Age (optional):</label>
<input type="number" name="age" id="age" min="3" max="100" />
</fieldset>
--fcc-editable-region--
@@ -80,10 +80,10 @@ assert.strictEqual(document.querySelector('fieldset:nth-of-type(2) input:nth-of-
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
<input
placeholder="example@email.com"
required
@@ -91,7 +91,7 @@ assert.strictEqual(document.querySelector('fieldset:nth-of-type(2) input:nth-of-
type="email"
name="email"
/>
<label for="age">Age(optional):</label>
<label for="age">Age (optional):</label>
<input type="number" name="age" id="age" min="3" max="100" />
</fieldset>
<fieldset>
@@ -56,10 +56,10 @@ assert.strictEqual(document.querySelector('fieldset:nth-of-type(3) legend').inne
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
<input
placeholder="example@email.com"
required
@@ -67,7 +67,7 @@ assert.strictEqual(document.querySelector('fieldset:nth-of-type(3) legend').inne
type="email"
name="email"
/>
<label for="age">Age(optional):</label>
<label for="age">Age (optional):</label>
<input type="number" name="age" id="age" min="3" max="100" />
</fieldset>
@@ -95,10 +95,10 @@ assert.strictEqual(document.querySelector("fieldset:nth-of-type(3) input[type='c
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
<input
placeholder="example@email.com"
required
@@ -106,7 +106,7 @@ assert.strictEqual(document.querySelector("fieldset:nth-of-type(3) input[type='c
type="email"
name="email"
/>
<label for="age">Age(optional):</label>
<label for="age">Age (optional):</label>
<input type="number" name="age" id="age" min="3" max="100" />
</fieldset>
@@ -78,10 +78,10 @@ assert.strictEqual(document.querySelector("fieldset:nth-of-type(3) input:nth-of-
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
<input
placeholder="example@email.com"
required
@@ -89,7 +89,7 @@ assert.strictEqual(document.querySelector("fieldset:nth-of-type(3) input:nth-of-
type="email"
name="email"
/>
<label for="age">Age(optional):</label>
<label for="age">Age (optional):</label>
<input type="number" name="age" id="age" min="3" max="100" />
</fieldset>
@@ -112,10 +112,10 @@ assert.strictEqual(document.querySelectorAll("fieldset:nth-of-type(3) input[type
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
<input
placeholder="example@email.com"
required
@@ -123,7 +123,7 @@ assert.strictEqual(document.querySelectorAll("fieldset:nth-of-type(3) input[type
type="email"
name="email"
/>
<label for="age">Age(optional):</label>
<label for="age">Age (optional):</label>
<input type="number" name="age" id="age" min="3" max="100" />
</fieldset>
@@ -74,10 +74,10 @@ assert.strictEqual(document.querySelectorAll("fieldset:nth-of-type(3) input[type
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
<input
placeholder="example@email.com"
required
@@ -85,7 +85,7 @@ assert.strictEqual(document.querySelectorAll("fieldset:nth-of-type(3) input[type
type="email"
name="email"
/>
<label for="age">Age(optional):</label>
<label for="age">Age (optional):</label>
<input type="number" name="age" id="age" min="3" max="100" />
</fieldset>
@@ -74,10 +74,10 @@ assert.strictEqual(document.querySelectorAll('fieldset:nth-of-type(4) label')[0]
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
<input
placeholder="example@email.com"
required
@@ -85,7 +85,7 @@ assert.strictEqual(document.querySelectorAll('fieldset:nth-of-type(4) label')[0]
type="email"
name="email"
/>
<label for="age">Age(optional):</label>
<label for="age">Age (optional):</label>
<input type="number" name="age" id="age" min="3" max="100" />
</fieldset>
@@ -66,10 +66,10 @@ assert(document.querySelector('select[id="service"]'));
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
<input
placeholder="example@email.com"
required
@@ -77,7 +77,7 @@ assert(document.querySelector('select[id="service"]'));
type="email"
name="email"
/>
<label for="age">Age(optional):</label>
<label for="age">Age (optional):</label>
<input type="number" name="age" id="age" min="3" max="100" />
</fieldset>
@@ -112,10 +112,10 @@ assert.strictEqual(document.querySelector('option[value="excellent"]').textConte
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
<input
placeholder="example@email.com"
required
@@ -123,7 +123,7 @@ assert.strictEqual(document.querySelector('option[value="excellent"]').textConte
type="email"
name="email"
/>
<label for="age">Age(optional):</label>
<label for="age">Age (optional):</label>
<input type="number" name="age" id="age" min="3" max="100" />
</fieldset>
@@ -48,10 +48,10 @@ assert(document.querySelector('option[value="excellent"][selected]'));
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
<input
placeholder="example@email.com"
required
@@ -59,7 +59,7 @@ assert(document.querySelector('option[value="excellent"][selected]'));
type="email"
name="email"
/>
<label for="age">Age(optional):</label>
<label for="age">Age (optional):</label>
<input type="number" name="age" id="age" min="3" max="100" />
</fieldset>
@@ -62,10 +62,10 @@ assert(document.querySelector('select[name="food"]'));
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
<input
placeholder="example@email.com"
required
@@ -73,7 +73,7 @@ assert(document.querySelector('select[name="food"]'));
type="email"
name="email"
/>
<label for="age">Age(optional):</label>
<label for="age">Age (optional):</label>
<input type="number" name="age" id="age" min="3" max="100" />
</fieldset>
@@ -121,10 +121,10 @@ assert(document.querySelector('fieldset:nth-of-type(4) select#food option[value=
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
<input
placeholder="example@email.com"
required
@@ -132,7 +132,7 @@ assert(document.querySelector('fieldset:nth-of-type(4) select#food option[value=
type="email"
name="email"
/>
<label for="age">Age(optional):</label>
<label for="age">Age (optional):</label>
<input type="number" name="age" id="age" min="3" max="100" />
</fieldset>
@@ -48,10 +48,10 @@ assert.strictEqual(document.querySelector('label[for="comments"]').textContent,
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
<input
placeholder="example@email.com"
required
@@ -59,7 +59,7 @@ assert.strictEqual(document.querySelector('label[for="comments"]').textContent,
type="email"
name="email"
/>
<label for="age">Age(optional):</label>
<label for="age">Age (optional):</label>
<input type="number" name="age" id="age" min="3" max="100" />
</fieldset>
@@ -52,10 +52,10 @@ assert(document.querySelector('form textarea'));
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
<input
placeholder="example@email.com"
required
@@ -63,7 +63,7 @@ assert(document.querySelector('form textarea'));
type="email"
name="email"
/>
<label for="age">Age(optional):</label>
<label for="age">Age (optional):</label>
<input type="number" name="age" id="age" min="3" max="100" />
</fieldset>
@@ -60,10 +60,10 @@ assert(document.querySelector('textarea[rows="10"]'));
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
<input
placeholder="example@email.com"
required
@@ -71,7 +71,7 @@ assert(document.querySelector('textarea[rows="10"]'));
type="email"
name="email"
/>
<label for="age">Age(optional):</label>
<label for="age">Age (optional):</label>
<input type="number" name="age" id="age" min="3" max="100" />
</fieldset>
@@ -58,10 +58,10 @@ assert.strictEqual(document.querySelector('button').textContent, 'Submit');
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
<input
placeholder="example@email.com"
required
@@ -69,7 +69,7 @@ assert.strictEqual(document.querySelector('button').textContent, 'Submit');
type="email"
name="email"
/>
<label for="age">Age(optional):</label>
<label for="age">Age (optional):</label>
<input type="number" name="age" id="age" min="3" max="100" />
</fieldset>
@@ -170,10 +170,10 @@ assert.strictEqual(document.querySelector('button').textContent, 'Submit');
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
<input
placeholder="example@email.com"
required
@@ -181,7 +181,7 @@ assert.strictEqual(document.querySelector('button').textContent, 'Submit');
type="email"
name="email"
/>
<label for="age">Age(optional):</label>
<label for="age">Age (optional):</label>
<input type="number" name="age" id="age" min="3" max="100" />
</fieldset>
@@ -48,10 +48,10 @@ assert(document.querySelector("input#reputation[checked]"));
<form method="POST" action="https://hotel-feedback.freecodecamp.org">
<fieldset>
<legend>Personal Information</legend>
<label for="full-name">Name*:</label>
<label for="full-name">Name (required):</label>
<input type="text" id="full-name" name="name" placeholder="Ex. John Doe" required>
<label for="email">Email address*:</label>
<label for="email">Email address (required):</label>
<input
placeholder="example@email.com"
required
@@ -59,7 +59,7 @@ assert(document.querySelector("input#reputation[checked]"));
type="email"
name="email"
/>
<label for="age">Age(optional):</label>
<label for="age">Age (optional):</label>
<input type="number" name="age" id="age" min="3" max="100" />
</fieldset>