-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.html
More file actions
431 lines (400 loc) · 16.9 KB
/
example.html
File metadata and controls
431 lines (400 loc) · 16.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
<!DOCTYPE html>
<html lang="de-DE">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<title>Document</title>
<!-- Material Icons -->
<link
href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet"
/>
</head>
<body>
<header>Seitenkopf-Bereich</header>
<div>
<!-- - - - -->
<nav>
<ul>
<li>
<a
tabindex="-1"
href="#"
>link 1</a
>
</li>
<li>
<a
tabindex="-1"
href="#"
>link 2</a
>
</li>
<li>
<a
tabindex="-1"
href="#"
>link 3</a
>
</li>
</ul>
</nav>
<!-- - - - -->
</div>
<main>
<h1>Headline and some content</h1>
<article>
<h2>Login-Formular Beispiel</h2>
<form>
<fieldset>
<legend>Benutzeranmeldung</legend>
<div
aria-live="assertive"
class="input-group"
>
<label for="login-email">E-Mail - Adresse</label>
<input
type="email"
id="login-email"
name="email"
required
placeholder="z.B. mail@example.com"
autocomplete="off"
aria-describedby="email-hinweis-sr"
/>
<p
id="email-hinweis"
class="message default-language"
aria-hidden="true"
>
<span
class="material-icons"
aria-hidden="true"
>error_outline</span
>
Bitte geben Sie Ihre E-Mail-Adresse ein.
</p>
<p
id="email-hinweis-sr"
class="visibility-hidden sr-only screenreader-only"
>
Bitte geben Sie Ihre E-Mail-Adresse ein.
</p>
<p class="message error default-language">
<span
class="material-icons"
aria-hidden="true"
>error_outline</span
>
Fehlerhinweis: Du hast noch keine E-Mail
angegeben. Die E-Mail ist ein Pflichtangabe.
</p>
<p class="message info default-language">
<span
class="material-icons"
aria-hidden="true"
>error_outline</span
>
Fehlerbeseitigung: Bitte trage deine
E-Mailadresse ein.
</p>
<p class="message success default-language">
<span
class="material-icons"
aria-hidden="true"
>error_outline</span
>
Erfolgshinweis: E-Mail wurde erfolgreich
eingetragen.
</p>
</div>
<div class="input-group">
<label for="login-password">Passwort</label>
<input
type="password"
id="login-password"
name="password"
required
placeholder="Passwort"
autocomplete="off"
aria-describedby="password-hinweis-sr"
/>
<p
id="password-hinweis"
class="message default-language"
aria-hidden="true"
>
<span
class="material-icons"
aria-hidden="true"
>error_outline</span
>Bitte geben Sie Ihr Passwort ein.
</p>
<p
id="password-hinweis-sr"
class="visibility-hidden sr-only screenreader-only"
>
Bitte geben Sie Ihr Passwort ein.
</p>
</div>
<div class="input-group">
<input
type="checkbox"
name="store"
id="login-store"
/>
<label for="login-store"
>Anmeldedaten speichern</label
>
</div>
</fieldset>
<button type="submit">Anmelden</button>
</form>
</article>
<hr />
<article>
<header>
<time>12. Dezember 2024</time>
<address>Autor: Michael</address>
</header>
<aside>Marginaler Inhalt</aside>
<h2 tabindex="2">Artikelüberschrift</h2>
<table
tabindex="1"
border="1"
>
<thead>
<tr>
<th>One</th>
<th>Two</th>
<th>Three</th>
</tr>
</thead>
<tbody>
<tr>
<td>content 1</td>
<td>content 2</td>
<td>content 3</td>
</tr>
<tr>
<td>content 1</td>
<td>content 2</td>
<td>content 3</td>
</tr>
<tr>
<td>content 1</td>
<td>content 2</td>
<td>content 3</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="3">Fußzeile</td>
</tr>
</tfoot>
</table>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit.
Quisquam neque aliquid nobis necessitatibus assumenda? Enim
perferendis accusantium explicabo.
</p>
<p lang="en">An english sentence: one. two. three.</p>
<p lang="de">Ein deutscher Satz: eins. zwei. drei.</p>
<p lang="hu">Egy magyar mondat: egy. kettő. három.</p>
<p lang="kr">한국어 문장: 일. 이. 삼.</p>
<footer>Artikelfuß</footer>
</article>
</main>
<footer>
<address>© <time datetime="2024">2024</time> Michael</address>
<nav>
<ul>
<li><a href="">link to 1</a></li>
<li><a href="">link to 2</a></li>
<!-- <li><a href="">link to 3</a></li>
<li><a href="">link to 4</a></li>
<li><a href="">link to 5</a></li>
<li><a href="">link to 6</a></li>
<li><a href="">link to 7</a></li>
<li><a href="">link to 8</a></li>
<li><a href="">link to 9</a></li>
<li><a href="">link to 10</a></li>
<li><a href="">link to 11</a></li>
<li><a href="">link to 12</a></li> -->
</ul>
</nav>
</footer>
<!-- - - - - - - - - - - -->
<span>
<!-- Dynamisch generierte Stories -->
<div class="story">
<h3>Standard-Story</h3>
<div id="standard-story"></div>
<h3>Screenreader-Story</h3>
<div id="screenreader-story"></div>
<h3>Story in Leichter Sprache</h3>
<div id="leichtesprache-story"></div>
</div>
<script>
function generateStories() {
const standardStory = []
const screenreaderStory = []
const leichteSpracheStory = []
// Normaltext-Story mit Überschriften, legend, label, Hinweise, ohne visibility-hidden
document
.querySelectorAll(
"h2, legend, label, .message.default-language:not(.visibility-hidden)"
)
.forEach((element) => {
const text = element.innerText
standardStory.push(`N: ${text}`)
})
// Screenreader-Story generieren mit Strukturinformationen
const legend = document.querySelector("legend")
if (legend) {
screenreaderStory.push(
`SR: ${legend.innerText} [Abschnitt]`
)
}
document
.querySelectorAll(
"[aria-labelledby], [aria-describedby], [aria-live]"
)
.forEach((element) => {
const ariaLabelledby =
element.getAttribute("aria-labelledby")
const ariaDescribedby =
element.getAttribute("aria-describedby")
const ariaLive = element.getAttribute("aria-live")
// aria-labelledby
if (ariaLabelledby) {
const labelElement =
document.getElementById(ariaLabelledby)
if (labelElement) {
let structureInfo =
element.tagName === "INPUT"
? " [Eingabefeld]"
: ""
screenreaderStory.push(
`SR: ${labelElement.innerText}${structureInfo}`
)
}
}
// aria-describedby
if (ariaDescribedby) {
const descriptionElement =
document.getElementById(ariaDescribedby)
if (descriptionElement) {
let structureInfo =
element.tagName === "INPUT"
? " [Eingabefeld]"
: ""
screenreaderStory.push(
`SR: ${descriptionElement.innerText}${structureInfo}`
)
}
}
// aria-live
if (ariaLive && element.innerText.trim() !== "") {
screenreaderStory.push(
`SR: ${element.innerText}`
)
}
})
// Hinzufügen von Strukturinformationen für andere Elemente
document.querySelectorAll("button").forEach((button) => {
screenreaderStory.push(
`SR: ${button.innerText} [Schaltfläche]`
)
})
// Leichte Sprache Story aus Elementen mit Überschriften, legend, label, Hinweise, ohne visibility-hidden
document
.querySelectorAll(
"h2, legend, label, .message.leichte-sprache:not(.visibility-hidden)"
)
.forEach((element) => {
const text = element.innerText
leichteSpracheStory.push(`LS: ${text}`)
})
// Story-Elemente dynamisch einfügen
document.getElementById("standard-story").innerHTML =
standardStory.map((text) => `<p>${text}</p>`).join("")
document.getElementById("screenreader-story").innerHTML =
screenreaderStory
.map((text) => `<p>${text}</p>`)
.join("")
document.getElementById("leichtesprache-story").innerHTML =
leichteSpracheStory
.map((text) => `<p>${text}</p>`)
.join("")
}
// Stories generieren beim Laden der Seite
document.addEventListener("DOMContentLoaded", generateStories)
</script>
<style>
.default-language {
color: hsla(210, 50%, 70%, 0.85);
}
.screenreader-only {
color: hsla(310, 50%, 70%, 0.85);
}
.leichte-sprache {
color: hsla(80, 50%, 70%, 0.85);
}
.default-language::before {
content: "N: ";
}
.screenreader-only::before {
content: "SR: ";
}
.leichte-sprache::before {
content: "LS: ";
}
.story {
margin-top: 30px;
max-width: 600px;
color: #ffffff;
font-size: 1em;
background-color: #2c2c2c;
padding: 15px;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}
.story h2 {
font-size: 1.3em;
color: #ffffff;
}
.story p {
margin: 10px 0;
}
.visibility-hidden {
text-decoration: line-through;
text-decoration-color: lightgrey;
}
.error {
color: hsla(0, 90%, 50%, 0.85);
}
.info {
color: hsla(210, 90%, 50%, 0.85);
}
.success {
color: hsla(120, 70%, 50%, 0.85);
}
</style>
</span>
<link
rel="stylesheet"
href="assets/screenreader/screenreader.css"
/>
<link
rel="stylesheet"
href="assets/screenreader/vkey.css"
/>
<script src="assets/screenreader/screenreader.js"></script>
<script src="assets/screenreader/vkey.js"></script>
<script src="assets/screenreader/vkey-usage.js"></script>
</body>
</html>