-
Notifications
You must be signed in to change notification settings - Fork 0
/
tabbed-carousel.html
145 lines (145 loc) · 11.9 KB
/
tabbed-carousel.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Tabbed carousel</title>
<script src="js/frontend-es5.js"></script>
<link rel="stylesheet" href="css/frontend.css" />
</head>
<body>
<h1>Tabbed carousel</h1>
<p>This is a Cypress test page. For specifications, please see the <a href="/mochawesome-report/mochawesome.html">Cypress test report</a>.</p>
<div id="test-1">
<h2>Test 1: Tabs with Manual Activation</h2>
<p>This configuration is appropriate for image carousels where images within hidden tabs are not preloaded.</p>
<button class="test-focus-start" id="test-1-start">Start test</button>
<div class="tabbed-carousel" data-initial-selection="1">
<div role="tablist" class="tabbed-carousel__tablist" aria-label="Choose photo to display">
<button role="tab" class="tabbed-carousel__tab" aria-controls="test-1-tabpanel-1" aria-selected="true" id="test-1-tab-1" tabindex="0" disabled>
<img src="http://placehold.it/44x44?text=1" alt="Photo 1">
</button>
<button role="tab" class="tabbed-carousel__tab" aria-controls="test-1-tabpanel-2" aria-selected="false" id="test-1-tab-2" tabindex="-1" disabled>
<img src="http://placehold.it/44x44?text=2" alt="Photo 2">
</button>
<button role="tab" class="tabbed-carousel__tab" aria-controls="test-1-tabpanel-3" aria-selected="false" id="test-1-tab-3" tabindex="-1" disabled>
<img src="http://placehold.it/44x44?text=3" alt="Photo 3">
</button>
<button role="tab" class="tabbed-carousel__tab" aria-controls="test-1-tabpanel-4" aria-selected="false" id="test-1-tab-4" tabindex="-1" disabled>
<img src="http://placehold.it/44x44?text=4" alt="Photo 4">
</button>
<button role="tab" class="tabbed-carousel__tab" aria-controls="test-1-tabpanel-5" aria-selected="false" id="test-1-tab-5" tabindex="-1" disabled>
<img src="http://placehold.it/44x44?text=5" alt="Photo 5">
</button>
</div>
<div class="tabbed-carousel__tabpanels">
<!-- Next element in the page tab is typically either the first focusable element inside the tab panel or the tab panel itself. -->
<div class="tabbed-carousel__tabpanel" role="tabpanel" id="test-1-tabpanel-1" aria-labelledby="test-1-tab-1" tabindex="0">
<h2 class="tabbed-carousel__tabpanel-title">Image 1</h2>
<div class="tabbed-carousel__tabpanel-img-wrap tabbed-carousel__tabpanel-img-wrap--collapsed" id="test-1-tab-1-img-wrap">
<img src="http://placehold.it/400x300" alt="Description of photo 1">
</div>
</div>
<div class="tabbed-carousel__tabpanel" role="tabpanel" id="test-1-tabpanel-2" aria-labelledby="test-1-tab-2" tabindex="0" hidden>
<h2 class="tabbed-carousel__tabpanel-title">Image 2</h2>
<div class="tabbed-carousel__tabpanel-img-wrap tabbed-carousel__tabpanel-img-wrap--collapsed" id="test-1-tab-2-img-wrap">
<img src="http://placehold.it/400x300" alt="Description of photo 2">
</div>
</div>
<div class="tabbed-carousel__tabpanel" role="tabpanel" id="test-1-tabpanel-3" aria-labelledby="test-1-tab-3" tabindex="0" hidden>
<h2 class="tabbed-carousel__tabpanel-title">Image 3</h2>
<div class="tabbed-carousel__tabpanel-img-wrap tabbed-carousel__tabpanel-img-wrap--collapsed" id="test-1-tab-3-img-wrap">
<img src="http://placehold.it/400x300" alt="Description of photo 3">
</div>
</div>
<div class="tabbed-carousel__tabpanel" role="tabpanel" id="test-1-tabpanel-4" aria-labelledby="test-1-tab-4" tabindex="0" hidden>
<h2 class="tabbed-carousel__tabpanel-title">Image 4</h2>
<div class="tabbed-carousel__tabpanel-img-wrap tabbed-carousel__tabpanel-img-wrap--collapsed" id="test-1-tab-4-img-wrap">
<img src="http://placehold.it/400x300" alt="Description of photo 4">
</div>
</div>
<div class="tabbed-carousel__tabpanel" role="tabpanel" id="test-1-tabpanel-5" aria-labelledby="test-1-tab-5" tabindex="0" hidden>
<h2 class="tabbed-carousel__tabpanel-title">Image 5</h2>
<div class="tabbed-carousel__tabpanel-img-wrap tabbed-carousel__tabpanel-img-wrap--collapsed" id="test-1-tab-5-img-wrap">
<img src="http://placehold.it/400x300" alt="Description of photo 5">
</div>
</div>
<!--
nav is after slides in order to have the active slide adjacent to the active tab in the tab sequence
this is in contrast with the WAI-ARIA Carousel example, which doesn't have tab navigation
-->
<div class="tabbed-carousel__tabpanels-nav">
<button type="button" data-tabbed-content-nav-expand class="tabbed-carousel__tabpanels-nav-expand" aria-expanded="false" aria-controls="test-1-tab-1-img-wrap test-1-tab-2-img-wrap test-1-tab-3-img-wrap test-1-tab-4-img-wrap test-1-tab-5-img-wrap" disabled>Expand</button>
<button type="button" data-tabbed-content-nav-previous class="tabbed-carousel__tabpanels-nav-previous" data-kh-proxy="selectPrevious" disabled>Previous</button>
<button type="button" data-tabbed-content-nav-next class="tabbed-carousel__tabpanels-nav-next" data-kh-proxy="selectNext" disabled>Next</button>
</div>
</div>
</div>
</div>
<div id="test-2">
<h2>Test 2: Tabs with Automatic Activation</h2>
<p>This configuration is appropriate for image carousels where images within hidden tabs are preloaded.</p>
<button class="test-focus-start" id="test-2-start">Start test</button>
<div class="tabbed-carousel" data-selection-follows-focus="true" data-initial-selection="1">
<div role="tablist" class="tabbed-carousel__tablist" aria-label="Choose photo to display">
<button role="tab" class="tabbed-carousel__tab" aria-controls="test-2-tabpanel-1" aria-selected="true" id="test-2-tab-1" tabindex="0" disabled>
<img src="http://placehold.it/44x44?text=1" alt="Photo 1">
</button>
<button role="tab" class="tabbed-carousel__tab" aria-controls="test-2-tabpanel-2" aria-selected="false" id="test-2-tab-2" tabindex="-1" disabled>
<img src="http://placehold.it/44x44?text=2" alt="Photo 2">
</button>
<button role="tab" class="tabbed-carousel__tab" aria-controls="test-2-tabpanel-3" aria-selected="false" id="test-2-tab-3" tabindex="-1" disabled>
<img src="http://placehold.it/44x44?text=3" alt="Photo 3">
</button>
<button role="tab" class="tabbed-carousel__tab" aria-controls="test-2-tabpanel-4" aria-selected="false" id="test-2-tab-4" tabindex="-1" disabled>
<img src="http://placehold.it/44x44?text=4" alt="Photo 4">
</button>
<button role="tab" class="tabbed-carousel__tab" aria-controls="test-2-tabpanel-5" aria-selected="false" id="test-2-tab-5" tabindex="-1" disabled>
<img src="http://placehold.it/44x44?text=5" alt="Photo 5">
</button>
</div>
<div class="tabbed-carousel__tabpanels">
<!-- Next element in the page tab is typically either the first focusable element inside the tab panel or the tab panel itself. -->
<div class="tabbed-carousel__tabpanel" role="tabpanel" id="test-2-tabpanel-1" aria-labelledby="test-2-tab-1" tabindex="0">
<h2 class="tabbed-carousel__tabpanel-title">Image 1</h2>
<div class="tabbed-carousel__tabpanel-img-wrap tabbed-carousel__tabpanel-img-wrap--collapsed" id="test-2-tab-1-img-wrap">
<img src="http://placehold.it/400x300" alt="Description of photo 1">
</div>
</div>
<div class="tabbed-carousel__tabpanel" role="tabpanel" id="test-2-tabpanel-2" aria-labelledby="test-2-tab-2" tabindex="0" hidden>
<h2 class="tabbed-carousel__tabpanel-title">Image 2</h2>
<div class="tabbed-carousel__tabpanel-img-wrap tabbed-carousel__tabpanel-img-wrap--collapsed" id="test-2-tab-2-img-wrap">
<img src="http://placehold.it/400x300" alt="Description of photo 2">
</div>
</div>
<div class="tabbed-carousel__tabpanel" role="tabpanel" id="test-2-tabpanel-3" aria-labelledby="test-2-tab-3" tabindex="0" hidden>
<h2 class="tabbed-carousel__tabpanel-title">Image 3</h2>
<div class="tabbed-carousel__tabpanel-img-wrap tabbed-carousel__tabpanel-img-wrap--collapsed" id="test-2-tab-3-img-wrap">
<img src="http://placehold.it/400x300" alt="Description of photo 3">
</div>
</div>
<div class="tabbed-carousel__tabpanel" role="tabpanel" id="test-2-tabpanel-4" aria-labelledby="test-2-tab-4" tabindex="0" hidden>
<h2 class="tabbed-carousel__tabpanel-title">Image 4</h2>
<div class="tabbed-carousel__tabpanel-img-wrap tabbed-carousel__tabpanel-img-wrap--collapsed" id="test-2-tab-4-img-wrap">
<img src="http://placehold.it/400x300" alt="Description of photo 4">
</div>
</div>
<div class="tabbed-carousel__tabpanel" role="tabpanel" id="test-2-tabpanel-5" aria-labelledby="test-2-tab-5" tabindex="0" hidden>
<h2 class="tabbed-carousel__tabpanel-title">Image 5</h2>
<div class="tabbed-carousel__tabpanel-img-wrap tabbed-carousel__tabpanel-img-wrap--collapsed" id="test-2-tab-5-img-wrap">
<img src="http://placehold.it/400x300" alt="Description of photo 5">
</div>
</div>
<!--
nav is after slides in order to have the active slide adjacent to the active tab in the tab sequence
this is in contrast with the WAI-ARIA Carousel example, which doesn't have tab navigation
-->
<div class="tabbed-carousel__tabpanels-nav">
<button type="button" data-tabbed-content-nav-expand class="tabbed-carousel__tabpanels-nav-expand" aria-expanded="false" aria-controls="test-2-tab-1-img-wrap test-2-tab-2-img-wrap test-2-tab-3-img-wrap test-2-tab-4-img-wrap test-2-tab-5-img-wrap" disabled>Expand</button>
<button type="button" data-tabbed-content-nav-previous class="tabbed-carousel__tabpanels-nav-previous" data-kh-proxy="selectPrevious" disabled>Previous</button>
<button type="button" data-tabbed-content-nav-next class="tabbed-carousel__tabpanels-nav-next" data-kh-proxy="selectNext" disabled>Next</button>
</div>
</div>
</div>
</div>
</body>
</html>