-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
401 lines (291 loc) · 9.87 KB
/
test.html
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
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Flyout Block Test</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
<link rel='stylesheet' id='flyout-block' href='dist/flyout-block.min.css' type='text/css' media='all' />
<link rel='stylesheet' id='flyout-animations' href='dist/flyout-animations.min.css' type='text/css' media='all' />
<script type="text/javascript" src="dist/animate-helper.min.js"></script>
<script type="text/javascript" src="dist/inert.min.js"></script>
<script type="text/javascript" src="dist/flyout-block.min.js"></script>
<script type="text/javascript">
var log = function( message ) {
var debugContainer = document.querySelector( '.debug-container' );
if ( debugContainer ) {
var newMessage = document.createElement( 'p' );
newMessage.innerText = message;
debugContainer.appendChild( newMessage );
}
}
var initFlyoutBlocks = function() {
if ( window.FlyoutBlock ) {
FlyoutBlock.init();
log( 'Flyout Blocks initialized.' );
}
else {
log( 'Flyout Block isn\'t loaded.' );
}
}
window.addEventListener( "DOMContentLoaded", function () { log( 'DOM Content loaded' ); } );
window.addEventListener( "DOMContentLoaded", function () { initFlyoutBlocks(); } );
window.addEventListener( "load", function () { log( 'Page loaded' ); } );
</script>
<style type="text/css">
* {
box-sizing: border-box;
}
hr {
margin-top: 30px;
margin-bottom: 30px;
}
.has-flyout [data-flyout-content] {
background-color: #00c49a;
}
.has-flyout [data-flyout-close] {
margin: 10px;
}
.form {
margin: 0 10px;
}
.form input {
margin: 10px 0;
}
.form input[type="text"] {
width: 300px;
}
</style>
</head>
<body>
<hr/>
<h2>Flyout Block -- from bottom (default)</h2>
<button data-flyout-toggle data-flyout-target="[data-flyout-from-bottom]">Show</button>
<div data-flyout data-flyout-from-bottom>
<div data-flyout-content>
<nav>
<ul>
<li>Menu item 1</li>
<li>Menu item 2</li>
<li>Menu item 3</li>
<li>Menu item 4</li>
<li>Menu item 5</li>
</ul>
</nav>
<button data-flyout-close>Close</button>
</div>
</div>
<hr/>
<h2>Flyout Block -- modal (displays as a modal window on large screens)</h2>
<button data-flyout-toggle data-flyout-target="[data-flyout-modal-1]">Show</button>
<div data-flyout data-flyout-modal data-flyout-modal-1>
<div data-flyout-content>
<nav>
<ul>
<li>Menu item 1</li>
<li>Menu item 2</li>
<li>Menu item 3</li>
<li>Menu item 4</li>
<li>Menu item 5</li>
</ul>
</nav>
<button data-flyout-close>Close</button>
</div>
</div>
<hr/>
<h2>Flyout Block -- modal (trigger initially disabled, focus on first focusable field)</h2>
<button data-flyout-toggle data-flyout-target="[data-flyout-modal-2]" disabled aria-hidden="true">Initialy Disabled</button>
<div data-flyout data-flyout-modal data-autofocus data-flyout-modal-2>
<div data-flyout-content>
The first focusable field should get focused.
<div class="form">
<input type="hidden" name="_hidden_field" placeholder="Should not appear" /><br>
<input type="text" name="_disabled_field" placeholder="This field is disabled" disabled /><br>
<input type="text" name="_first_focusable_field" placeholder="This is the first focusable field" /><br>
<input type="button" name="_second_focusable_field" value="This is the second focusable field" /><br>
</div>
<nav>
<ul>
<li>Menu item 1</li>
<li>Menu item 2</li>
<li>Menu item 3</li>
<li>Menu item 4</li>
<li>Menu item 5</li>
</ul>
</nav>
<button data-flyout-close>Close</button>
</div>
</div>
<hr/>
<h2>Flyout Block -- modal (manual focus)</h2>
<a href="https://github.com/fluidweb-co/flyout-block" data-flyout-toggle data-flyout-target="[data-flyout-modal-3]" disabled aria-hidden="true">Link trigger</a>
<a href="#modal-3" data-flyout-toggle disabled aria-hidden="true">Link trigger (href)</a>
<div id="modal-3" data-flyout data-flyout-modal data-flyout-modal-3 data-flyout-role="alert" data-flyout-manual-focus hidden>
<div data-flyout-content>
No focus should be set in this flyout block.
<div class="form">
<input type="hidden" name="_hidden_field" placeholder="Should not appear" /><br>
<input type="text" name="_disabled_field" placeholder="This field is disabled" disabled /><br>
<input type="text" name="_first_focusable_field" placeholder="This is the first focusable field" /><br>
<input type="button" name="_second_focusable_field" value="This is the second focusable field" /><br>
</div>
<nav>
<ul>
<li>Menu item 1</li>
<li>Menu item 2</li>
<li>Menu item 3</li>
<li>Menu item 4</li>
<li>Menu item 5</li>
</ul>
</nav>
<a href="#close-modal" data-flyout-close>Close</a>
</div>
</div>
<hr/>
<h2>Flyout Block -- from top (auto focus on second field)</h2>
<button data-flyout-toggle data-flyout-target="[data-flyout-from-top]">Show</button>
<div data-flyout data-flyout-from-top data-flyout-open-animation-class="slide-in-down" data-flyout-close-animation-class="slide-out-up">
<div data-flyout-content>
The second focusable field should get focus, as it has the attribute `data-autofocus`.
<div class="form">
<input type="hidden" name="_hidden_field" placeholder="Should not appear" /><br>
<input type="text" name="_disabled_field" placeholder="This field is disabled" disabled /><br>
<input type="text" name="_first_focusable_field" placeholder="This is the first focusable field" /><br>
<input type="button" name="_second_focusable_field" value="This is the second focusable field" data-autofocus /><br>
</div>
<nav>
<ul>
<li>Menu item 1</li>
<li>Menu item 2</li>
<li>Menu item 3</li>
<li>Menu item 4</li>
<li>Menu item 5</li>
</ul>
</nav>
<button data-flyout-close>Close</button>
</div>
</div>
<hr/>
<h2>Flyout Block -- from left (First heading as label, with description element marked with `data-flyout-description`)</h2>
<button data-flyout-toggle data-flyout-target="[data-flyout-from-left]">Show</button>
<div data-flyout data-flyout-modal data-flyout-from-left data-flyout-open-animation-class="slide-in-left" data-flyout-close-animation-class="slide-out-left">
<div data-flyout-content>
<h2>This is the title of the flyout block</h2>
<p data-flyout-description>This paragraph will describe the flyout block.</p>
<nav>
<ul>
<li>Menu item 1</li>
<li>Menu item 2</li>
<li>Menu item 3</li>
<li>Menu item 4</li>
<li>Menu item 5</li>
</ul>
</nav>
<button data-flyout-close>Close</button>
</div>
</div>
<hr/>
<h2>Flyout Block -- from right</h2>
<button data-flyout-toggle data-flyout-target="[data-flyout-from-right]">Show</button>
<div data-flyout data-flyout-from-right data-flyout-open-animation-class="slide-in-right" data-flyout-close-animation-class="slide-out-right">
<div data-flyout-content>
<nav>
<ul>
<li>Menu item 1</li>
<li>Menu item 2</li>
<li>Menu item 3</li>
<li>Menu item 4</li>
<li>Menu item 5</li>
</ul>
</nav>
<button data-flyout-close>Close</button>
</div>
</div>
<hr/>
<h2>Flyout Block -- fade</h2>
<button data-flyout-toggle data-flyout-target="[data-flyout-fade]">Show</button>
<div data-flyout data-flyout-fade data-flyout-open-animation-class="fade-in" data-flyout-close-animation-class="fade-out">
<div data-flyout-content>
<nav>
<ul>
<li>Menu item 1</li>
<li>Menu item 2</li>
<li>Menu item 3</li>
<li>Menu item 4</li>
<li>Menu item 5</li>
</ul>
</nav>
<button data-flyout-close>Close</button>
</div>
</div>
<hr/>
<h2>Flyout Block -- fade from bottom</h2>
<button data-flyout-toggle data-flyout-target="[data-flyout-fade-bottom]">Show</button>
<div data-flyout data-flyout-fade-bottom data-flyout-open-animation-class="fade-in-up" data-flyout-close-animation-class="fade-out-down">
<div data-flyout-content>
<nav>
<ul>
<li>Menu item 1</li>
<li>Menu item 2</li>
<li>Menu item 3</li>
<li>Menu item 4</li>
<li>Menu item 5</li>
</ul>
</nav>
<button data-flyout-close>Close</button>
</div>
</div>
<hr/>
<h2>Flyout Block -- fade from top</h2>
<button data-flyout-toggle data-flyout-target="[data-flyout-fade-top]">Show</button>
<div data-flyout data-flyout-fade-top data-flyout-open-animation-class="fade-in-down" data-flyout-close-animation-class="fade-out-up">
<div data-flyout-content>
<nav>
<ul>
<li>Menu item 1</li>
<li>Menu item 2</li>
<li>Menu item 3</li>
<li>Menu item 4</li>
<li>Menu item 5</li>
</ul>
</nav>
<button data-flyout-close>Close</button>
</div>
</div>
<hr/>
<h2>Flyout Block -- fade from left</h2>
<button data-flyout-toggle data-flyout-target="[data-flyout-fade-left]">Show</button>
<div data-flyout data-flyout-fade-left data-flyout-open-animation-class="fade-in-left" data-flyout-close-animation-class="fade-out-left">
<div data-flyout-content>
<nav>
<ul>
<li>Menu item 1</li>
<li>Menu item 2</li>
<li>Menu item 3</li>
<li>Menu item 4</li>
<li>Menu item 5</li>
</ul>
</nav>
<button data-flyout-close>Close</button>
</div>
</div>
<hr/>
<h2>Flyout Block -- fade from right</h2>
<button data-flyout-toggle data-flyout-target="[data-flyout-fade-right]">Show</button>
<div data-flyout data-flyout-fade-right data-flyout-open-animation-class="fade-in-right" data-flyout-close-animation-class="fade-out-right">
<div data-flyout-content>
<nav>
<ul>
<li>Menu item 1</li>
<li>Menu item 2</li>
<li>Menu item 3</li>
<li>Menu item 4</li>
<li>Menu item 5</li>
</ul>
</nav>
<button data-flyout-close>Close</button>
</div>
</div>
<hr/>
<div class="debug-container">
</div>
</body>
</html>