-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patha11ty-issues.css
More file actions
142 lines (122 loc) · 3.35 KB
/
a11ty-issues.css
File metadata and controls
142 lines (122 loc) · 3.35 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
/* Similar projects:
- https://github.com/SwansonRoss/a11y-style-sheet
- https://willmendesneto.com/posts/linting-web-accessibility-issues-in-your-html-using-just-css/
- https://dev.to/devmount/3-css-tricks-to-uncover-accessibility-issues-4fo8
*/
:root {
--nice-color: deeppink;
--nice-font: "Comic Sans MS", "Times New Roman", serif;
--nice-border: 5px dashed deeppink;
}
/* Missing html language attribute */
html:not([lang]),
html[lang=""] {
border-top: 20px solid var(--nice-color);
}
/* Missing alternative text for images */
img:not([alt], [role="presentation"]) {
border: var(--nice-border);
}
/* Missing role and aria label for canvas */
canvas:not([role]),
canvas:not([aria-label]),
canvas[role=""],
canvas[aria-label=""] {
border: var(--nice-border);
}
/* highlight on links without valid href attribute */
a[href="#"],
a[href=""],
a[href*="javascript:void(0)"] {
outline: var(--nice-border) !important;
}
/* highlight on empty anchors/buttons */
a:empty:not([aria-label],[aria-labelledby]),
button:empty:not([aria-label],[aria-labelledby]) {
border: var(--nice-border) !important;
}
/* <i> tag should not be used for icons */
i.fa {
color: var(--nice-color) !important;
font-family: var(--nice-font) !important;
font-size: 3em !important;
&::after {
content: '⚠️ This code harms application accessibility!';
display: inline;
}
}
h1 h1,
h1 ~ h1,
h1 ~ * h1 {
color: var(--nice-color) !important;
font-family: var(--nice-font) !important;
&::after {
content: '⚠️ Page should have a single <h1>!' !important;
display: inline;
}
}
main main,
main ~ main,
main ~ * main {
border: var(--nice-border);
&::after {
content: '⚠️ Page should have a single <main>!' !important;
display: inline;
}
}
button div,
button p,
label div,
label p {
color: var(--nice-color) !important;
font-family: var(--nice-font) !important;
&::after {
content: '⚠️ Invalid element, phrasing content expected!' !important; /* @see https://caninclude.glitch.me/can/include/ */
display: inline;
}
}
/* highlights label with invalid for attribute */
label:not([for],:has(input)),
label[for="#"],
label[for=""] {
border: var(--nice-border) !important;
}
canvas:not([role]),
canvas[role=""],
canvas:not([aria-label],[aria-labelledby]),
canvas[aria-labelledby=""],
canvas[aria-label=""] {
border: var(--nice-border);
}
p ul,
p dl,
p ol {
&::after {
content: '⚠️ Invalid element, phrasing content expected!' !important; /* @see https://caninclude.glitch.me/can/include/ */
display: inline;
}
}
h1,
h2,
h3,
h4,
h5,
h6 {
div, p {
color: var(--nice-color) !important;
font-family: var(--nice-font) !important;
&::after {
content: '⚠️ Invalid element, phrasing content expected!' !important; /* @see https://caninclude.glitch.me/can/include/ */
display: inline;
}
}
}
/* highlight on all elements that are inside of lists but not a list item <li> and displays them with a var(--nice-color) outline.*/
:is(ul, ol) > *:not(li) {
outline: var(--nice-border) !important;
}
/* Avoids div buttons from hell. More details in https://www.htmhell.dev/2-div-with-button-role/ */
div[role="button"] {
color: var(--nice-font);
text-decoration: blink !important;
}