-
Notifications
You must be signed in to change notification settings - Fork 0
/
a11ytips.css
253 lines (214 loc) · 8.04 KB
/
a11ytips.css
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
body {
counter-reset: tip-error-counter tip-warning-counter;
}
/**********
WARNINGS
**********/
/*** Element ***/
img[alt=""],
svg:not([role]),
*[role="application"],
button[role],
h1[role], h2[role], h3[role], h4[role], h5[role], h6[role],
a[role="button"] {
outline: dashed 3px rgb(255, 193, 7) !important;
counter-increment: tip-warning-counter;
}
/*** Message box ***/
img[alt=""] + ::before,
svg:not([role]) + ::before,
*[role="application"]::after,
button[role]::after,
h1[role]::after, h2[role]::after, h3[role]::after,
h4[role]::after, h5[role]::after, h6[role]::after,
a[role="button"]::after {
z-index: 10000 !important;
display: block !important;
position: fixed !important;
bottom: 6.5rem !important;
left: 1rem !important;
font-size: 1rem !important;
line-height: 1rem !important;
padding: 1rem !important;
color: #000 !important;
font-family: 'Lucida Grande', Helvetica, Arial, sans-serif !important;
font-weight: normal !important;
border: solid 2px rgb(255, 193, 7) !important;
background-color: rgb(255, 249, 230) !important;
opacity: 0 !important;
transition: opacity 200ms ease !important;
}
/********
ERRORS
********/
/*** Element ***/
img:not([alt]),
svg[role="img"]:not([aria-label]):not([aria-labelledby]),
svg[role="presentation"][aria-label],
svg[role="presentation"][aria-labelledby],
button:empty:not([aria-label]):not([aria-labelledby]),
input[type="button"]:empty:not([aria-label]):not([aria-labelledby]),
a:empty:not([aria-label]):not([aria-labelledby]),
*[tabindex]:not([tabindex="-1"]):not([tabindex="0"]),
*[aria-pressed]:not(button),
*[role="checkbox"]:not([aria-checked]),
*[role="radio"]:not([aria-checked]),
*:not(a)[role="button"],
button[aria-hidden="true"]:not([tabindex="-1"]),
input[type="button"][aria-hidden="true"]:not([tabindex="-1"]),
a[href][aria-hidden="true"]:not([tabindex="-1"]) {
outline: dashed 3px rgb(244, 67, 54) !important;
counter-increment: tip-error-counter;
}
/*** Message box ***/
img:not([alt]) + ::before,
svg[role="img"]:not([aria-label]):not([aria-labelledby]) + ::before,
svg[role="presentation"][aria-label] + ::before,
svg[role="presentation"][aria-labelledby] + ::before,
button:empty:not([aria-label]):not([aria-labelledby])::after,
input[type="button"]:empty:not([aria-label]):not([aria-labelledby])::after,
a:empty:not([aria-label]):not([aria-labelledby])::after,
*[tabindex]:not([tabindex="-1"]):not([tabindex="0"])::after,
*[aria-pressed]:not(button)::after,
*[role="checkbox"]:not([aria-checked])::after,
*[role="radio"]:not([aria-checked])::after,
*:not(a)[role="button"]::after,
button[aria-hidden="true"]:not([tabindex="-1"])::after,
input[type="button"][aria-hidden="true"]:not([tabindex="-1"])::after,
a[href][aria-hidden="true"]:not([tabindex="-1"])::after {
z-index: 10000 !important;
display: block !important;
position: fixed !important;
bottom: 6.5rem !important;
left: 1rem !important;
font-size: 1rem !important;
line-height: 1rem !important;
padding: 1rem !important;
color: #000 !important;
font-family: 'Lucida Grande', Helvetica, Arial, sans-serif !important;
font-weight: normal !important;
border: solid 2px rgb(244, 67, 54) !important;
background-color: rgb(255, 250, 249) !important;
opacity: 0 !important;
transition: opacity 200ms ease !important;
}
/*****
ALL
*****/
/*** Show message box ***/
img:not([alt]):hover + ::before,
img[alt=""]:hover + ::before,
svg[role="img"]:not([aria-label]):not([aria-labelledby]):hover + ::before,
svg[role="presentation"][aria-label]:hover + ::before,
svg[role="presentation"][aria-labelledby]:hover + ::before,
svg:not([role]):hover + ::before,
*[role="application"]:hover::after,
button:empty:not([aria-label]):not([aria-labelledby]):hover::after,
input[type="button"]:empty:not([aria-label]):not([aria-labelledby]):hover::after,
a:empty:not([aria-label]):not([aria-labelledby]):hover::after,
*[tabindex]:not([tabindex="-1"]):not([tabindex="0"]):hover::after,
*[aria-pressed]:not(button):hover::after,
*[role="checkbox"]:not([aria-checked]):hover::after,
*[role="radio"]:not([aria-checked]):hover::after,
button[role]:hover::after,
h1[role]:hover::after, h2[role]:hover::after, h3[role]:hover::after,
h4[role]:hover::after, h5[role]:hover::after, h6[role]:hover::after,
*[role="button"]:hover::after,
button[aria-hidden="true"]:not([tabindex="-1"]):hover::after,
input[type="button"][aria-hidden="true"]:not([tabindex="-1"]):hover::after,
a[href][aria-hidden="true"]:not([tabindex="-1"]):hover::after {
opacity: 1 !important;
}
/**********
MESSAGES
**********/
/* Alt text can be empty for decorative images only - warning */
img[alt=""] + ::before {
content: 'Image alt text is empty' !important;
}
/* Svg does not indicate a role - valid, but likely an oversight */
svg:not([role]) + ::before {
content: 'SVG does not have an aria role' !important;
}
/* Using a role of application is very dangerous */
*[role="application"]::after {
content: 'Role of application - use with caution!' !important;
}
/* Roles should not be used on elements that already have semantic behaviour */
button[role]::after,
h1[role]::after, h2[role]::after, h3[role]::after,
h4[role]::after, h5[role]::after, h6[role]::after {
content: 'Role will override native semantics' !important;
}
/* If it's a button, use a button */
*[role="button"]::after {
content: 'Use <button> element instead of role' !important;
}
/* Image elements must have alt text */
img:not([alt]) + ::before {
content: 'Image is missing alt text' !important;
}
/* Svg as image must have aria label or aria labelled by */
svg[role="img"]:not([aria-label]):not([aria-labelledby]) + ::before {
content: 'SVG has role of img and no aria label' !important;
}
/* Svg can be decorative or informative, not both */
svg[role="presentation"][aria-label] + ::before,
svg[role="presentation"][aria-labelledby] + ::before {
content: 'SVG has role of presentation and aria label' !important;
}
/* Empty button with no accessible label */
button:empty:not([aria-label]):not([aria-labelledby])::after,
input[type="button"]:empty:not([aria-label]):not([aria-labelledby])::after {
content: 'Button has no text or aria label' !important;
}
/* Empty link with no accessible label */
a:empty:not([aria-label]):not([aria-labelledby])::after {
content: 'Link has no text or aria label' !important;
}
/* Tab index should not disrupt the natural tab order */
*[tabindex]:not([tabindex="-1"]):not([tabindex="0"])::after {
content: 'Tab index greater than zero' !important;
}
/* aria-pressed should only be used with toggle buttons */
*[aria-pressed]:not(button):not([role="button"])::after {
content: 'aria-pressed on non-button element' !important;
}
/* aria-checked is a required attribute on checkboxes */
/* (even better, use native elements) */
*[role="checkbox"]:not([aria-checked])::after {
content: 'aria-checked is required for checkboxes' !important;
}
/* aria-checked is a required attribute on radio buttons */
/* (even better, use native elements) */
*[role="radio"]:not([aria-checked])::after {
content: 'aria-checked is required for radio buttons' !important;
}
/* Using aria-hidden on an element which can still receive keyboard focus
will cause the user to focus on "nothing" */
button[aria-hidden="true"]:not([tabindex="-1"])::after,
input[type="button"][aria-hidden="true"]:not([tabindex="-1"])::after,
a[href][aria-hidden="true"]:not([tabindex="-1"])::after {
content: 'aria-hidden used on a focusable element' !important;
}
/*********
SUMMARY
*********/
/*** Message box ***/
body::after {
z-index: 10000 !important;
display: block !important;
position: fixed !important;
bottom: 1rem !important;
left: 1rem !important;
font-size: 1rem !important;
line-height: 1.5rem !important;
padding: 1rem !important;
color: #000 !important;
font-family: 'Lucida Grande', Helvetica, Arial, sans-serif !important;
font-weight: normal !important;
background-color: rgb(240, 240, 240) !important;
border: solid 2px rgb(150, 150, 150) !important;
white-space: pre !important;
content: 'Issues: ' counter(tip-error-counter) '\AWarnings: ' counter(tip-warning-counter) !important;
}