Skip to content

Commit 48e8653

Browse files
fix(curriculum): replace D.O.B. acronym in accessibility quiz (freeCodeCamp#54829)
Co-authored-by: Naomi the Technomancer <[email protected]>
1 parent 628b559 commit 48e8653

File tree

48 files changed

+420
-260
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+420
-260
lines changed

curriculum/challenges/english/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/6143908b6aafb00a659ca189.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ assert.notEmpty(document.querySelectorAll('input')?.[0]?.placeholder);
9393
<input id="student-email" />
9494
</div>
9595
<div class="info">
96-
<label for="birth-date">D.O.B.:</label>
96+
<label for="birth-date">Date of Birth:</label>
9797
<input id="birth-date" />
9898
</div>
9999
</section>

curriculum/challenges/english/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/6143920c8eafb00b735746ce.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ assert.isEmpty(document.querySelectorAll('input')?.[0]?.placeholder);
6060
<input type="email" name="student-email" id="student-email" />
6161
</div>
6262
<div class="info">
63-
<label for="birth-date">D.O.B.:</label>
63+
<label for="birth-date">Date of Birth:</label>
6464
<input type="date" name="birth-date" id="birth-date" />
6565
</div>
6666
</section>

curriculum/challenges/english/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/6143931a113bb80c45546287.md

Lines changed: 72 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,76 @@ dashedName: step-23
77

88
# --description--
99

10-
Arguably, `D.O.B.` is not descriptive enough. This is especially true for visually impaired users. One way to get around such an issue, without having to add visible text to the label, is to add text only a screen reader can read.
10+
Within the second `section` element, add two `div` elements with a class of `question-block`.
1111

12-
Append a `span` element with a class of `sr-only` to the current text content of the third `label` element.
12+
Then, within each `div.question-block` element, add one `h3` element with text of incrementing numbers, starting at `1`, and one `fieldset` element with a class of `question`.
1313

1414
# --hints--
1515

16-
You should add a `span` element within the third `label` element.
16+
You should nest two `div` elements within the second `section` element.
1717

1818
```js
19-
assert.exists(document.querySelector('.info:nth-of-type(3) > label > span'));
19+
assert.equal(document.querySelectorAll('section:nth-of-type(2) > div')?.length, 2);
2020
```
2121
22-
You should give the `span` element a class of `sr-only`.
22+
You should give the first new `div` element a class of `question-block`.
2323
2424
```js
25-
assert.equal(document.querySelector('.info:nth-of-type(3) > label > span')?.className, 'sr-only');
25+
assert.equal(document.querySelectorAll('section:nth-of-type(2) > div')?.[0]?.className, 'question-block');
2626
```
2727
28-
You should place the `span` after the text content `D.O.B.`.
28+
You should give the second new `div` element a class of `question-block`.
2929
3030
```js
31-
assert.match(document.querySelector('.info:nth-of-type(3) > label')?.innerHTML, /D\.O\.B\.<span/);
31+
assert.equal(document.querySelectorAll('section:nth-of-type(2) > div')?.[1]?.className, 'question-block');
32+
```
33+
34+
You should nest one `h3` element within each `div.question-block` element.
35+
36+
```js
37+
assert.equal(document.querySelectorAll('section:nth-of-type(2) > div.question-block > h3')?.length, 2);
38+
```
39+
40+
You should give the first `h3` element text of `1`.
41+
42+
```js
43+
assert.equal(document.querySelectorAll('section:nth-of-type(2) > div.question-block > h3')?.[0]?.textContent, '1');
44+
```
45+
46+
You should give the second `h3` element text of `2`.
47+
48+
```js
49+
assert.equal(document.querySelectorAll('section:nth-of-type(2) > div.question-block > h3')?.[1]?.textContent, '2');
50+
```
51+
52+
You should nest one `fieldset` element within each `div.question-block` element.
53+
54+
```js
55+
assert.equal(document.querySelectorAll('section:nth-of-type(2) > div.question-block > fieldset')?.length, 2);
56+
```
57+
58+
You should place the first `fieldset` element after the first `h3` element.
59+
60+
```js
61+
assert.exists(document.querySelector('section:nth-of-type(2) > div.question-block > h3 + fieldset'));
62+
```
63+
64+
You should place the second `fieldset` element after the second `h3` element.
65+
66+
```js
67+
assert.exists(document.querySelector('section:nth-of-type(2) > div.question-block:nth-of-type(2) > h3 + fieldset'));
68+
```
69+
70+
You should give the first `fieldset` element a class of `question`.
71+
72+
```js
73+
assert.equal(document.querySelectorAll('section:nth-of-type(2) > div.question-block > fieldset')?.[0]?.className, 'question');
74+
```
75+
76+
You should give the second `fieldset` element a class of `question`.
77+
78+
```js
79+
assert.equal(document.querySelectorAll('section:nth-of-type(2) > div.question-block > fieldset')?.[1]?.className, 'question');
3280
```
3381
3482
# --seed--
@@ -69,16 +117,17 @@ assert.match(document.querySelector('.info:nth-of-type(3) > label')?.innerHTML,
69117
<label for="student-email">Email:</label>
70118
<input type="email" name="student-email" id="student-email" />
71119
</div>
72-
--fcc-editable-region--
73120
<div class="info">
74-
<label for="birth-date">D.O.B.</label>
121+
<label for="birth-date">Date of Birth:</label>
75122
<input type="date" name="birth-date" id="birth-date" />
76123
</div>
77-
--fcc-editable-region--
78124
</section>
125+
--fcc-editable-region--
79126
<section role="region" aria-labelledby="html-questions">
80127
<h2 id="html-questions">HTML</h2>
128+
81129
</section>
130+
--fcc-editable-region--
82131
<section role="region" aria-labelledby="css-questions">
83132
<h2 id="css-questions">CSS</h2>
84133
</section>
@@ -136,4 +185,16 @@ h2 {
136185
border-bottom: 4px solid #dfdfe2;
137186
}
138187

188+
.sr-only {
189+
position: absolute;
190+
width: 1px;
191+
height: 1px;
192+
padding: 0;
193+
margin: -1px;
194+
overflow: hidden;
195+
clip: rect(0, 0, 0, 0);
196+
white-space: nowrap;
197+
border: 0;
198+
}
199+
139200
```

curriculum/challenges/english/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/614394fb41985e0d2012a93e.md

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,34 @@ dashedName: step-24
77

88
# --description--
99

10-
Within the `span` element, add the text `(Date of Birth)`.
10+
The question numbers are not descriptive enough. This is especially true for visually impaired users. One way to get around such an issue, without having to add visible text to the element, is to add text only a screen reader can read.
11+
12+
Append a `span` element with a `class` of `sr-only` to each of the `h3` elements.
1113

1214
# --hints--
1315

14-
You should give the `span` element the text `(Date of Birth)`.
16+
You should add a `span` element within the first `h3` element.
17+
18+
```js
19+
assert.exists(document.querySelector('h3 > span'));
20+
```
21+
22+
You should give the first `span` element a `class` of `sr-only`.
1523

1624
```js
17-
assert.equal(document.querySelector('.info:nth-of-type(3) > label > span')?.textContent, '(Date of Birth)');
25+
assert.equal(document.querySelector('span')?.className, 'sr-only');
26+
```
27+
28+
You should add a `span` element within the second `h3` element.
29+
30+
```js
31+
assert.exists(document.querySelectorAll('h3 > span')[1]);
32+
```
33+
34+
You should give the second `span` element a `class` of `sr-only`.
35+
36+
```js
37+
assert.equal(document.querySelectorAll('span')[1]?.className, 'sr-only');
1838
```
1939
2040
# --seed--
@@ -55,15 +75,23 @@ assert.equal(document.querySelector('.info:nth-of-type(3) > label > span')?.text
5575
<label for="student-email">Email:</label>
5676
<input type="email" name="student-email" id="student-email" />
5777
</div>
58-
--fcc-editable-region--
5978
<div class="info">
60-
<label for="birth-date">D.O.B.<span class="sr-only"></span></label>
79+
<label for="birth-date">Date of Birth:</label>
6180
<input type="date" name="birth-date" id="birth-date" />
6281
</div>
63-
--fcc-editable-region--
6482
</section>
6583
<section role="region" aria-labelledby="html-questions">
6684
<h2 id="html-questions">HTML</h2>
85+
<div class="question-block">
86+
--fcc-editable-region--
87+
<h3>1</h3>
88+
<fieldset class="question"></fieldset>
89+
</div>
90+
<div class="question-block">
91+
<h3>2</h3>
92+
--fcc-editable-region--
93+
<fieldset class="question"></fieldset>
94+
</div>
6795
</section>
6896
<section role="region" aria-labelledby="css-questions">
6997
<h2 id="css-questions">CSS</h2>
@@ -122,4 +150,16 @@ h2 {
122150
border-bottom: 4px solid #dfdfe2;
123151
}
124152

153+
.sr-only {
154+
position: absolute;
155+
width: 1px;
156+
height: 1px;
157+
padding: 0;
158+
margin: -1px;
159+
overflow: hidden;
160+
clip: rect(0, 0, 0, 0);
161+
white-space: nowrap;
162+
border: 0;
163+
}
164+
125165
```

0 commit comments

Comments
 (0)