-
Notifications
You must be signed in to change notification settings - Fork 0
/
modals.html
361 lines (337 loc) · 17.4 KB
/
modals.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
<!DOCTYPE html>
<html lang="en-us" ng-app="website">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>BigCommerce Pattern Lab</title>
<link rel="shortcut icon" href="https://cdn6.bigcommerce.com/r-d9855a91e0124a20a1d8b36949bceaafdb22a7f1/img/bc_favicon.ico" />
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400italic,600,600italic">
<link rel="stylesheet" href="css/bcapp-pattern-lab.css" />
<link rel="stylesheet" href="css/website.css" />
</head>
<body>
<nav class="navBar topNavBar">
<div class="container">
<ul class="navBar-section topNavBar-section">
<li class="navBar-item topNavBar-item">
<a href="/">
<picture class="navBar-picture">
<img class="navBar-logo-condensed" src="/svg/logo.svg" alt="BigCommerce Logo" />
<img class="navBar-logo" src="/svg/bclogo.svg" alt="BigCommerce Logo" />
</picture>
</a>
</li>
<li class="navBar-item topNavBar-item">
<div class="topNavBar-label">
Pattern Lab (v2.12.1)
</div>
</li>
</ul>
<ul class="navBar-section navBar-section--alt topNavBar-section--alt">
<li class="navBar-item topNavBar-item ">
<a class="navBar-action topNavBar-action" href="/style.html">Style</a>
</li>
<li class="navBar-item topNavBar-item is-active">
<a class="navBar-action topNavBar-action" href="/components.html">Components</a>
</li>
<li class="navBar-item topNavBar-item ">
<a class="navBar-action topNavBar-action" href="/patterns.html">Patterns</a>
</li>
<li class="navBar-item topNavBar-item ">
<a class="navBar-action topNavBar-action" href="/app-containers.html">Layouts</a>
</li>
<li class="navBar-item topNavBar-item ">
<a class="navBar-action topNavBar-action" href="/utils.html">Developer Utilities</a>
</li>
<li class="navBar-item topNavBar-item ">
<a class="navBar-action topNavBar-action" href="https://github.com/bigcommerce-labs/bcapp-pattern-lab/releases">Change Log</a>
</li>
</ul>
</div>
</nav>
<div class="container">
<aside class="aside" ng-controller="AsideNavCtrl">
<nav class="asideNav">
<h2 class="asideNav-header">
<a class="asideNav-header-link" href="/components.html">
Components
</a>
</h2>
<ul class="asideNav-list">
<li class="asideNav-listItem" ng-class="{'is-active': isActive('/accordion.html')}">
<a class="asideNav-link" href="/accordion.html">Accordion</a>
</li>
<li class="asideNav-listItem" ng-class="{'is-active': isActive('/buttons.html')}">
<a class="asideNav-link" href="/buttons.html">Buttons</a>
</li>
<li class="asideNav-listItem" ng-class="{'is-active': isActive('/cards.html')}">
<a class="asideNav-link" href="/cards.html">Cards</a>
</li>
<li class="asideNav-listItem" ng-class="{'is-active': isActive('/dropdowns.html')}">
<a class="asideNav-link" href="/dropdowns.html">Dropdowns</a>
</li>
<li class="asideNav-listItem" ng-class="{'is-active': isActive('/forms.html')}">
<a class="asideNav-link" href="/forms.html">Forms</a>
</li>
<li class="asideNav-listItem" ng-class="{'is-active': isActive('/modals.html')}">
<a class="asideNav-link" href="/modals.html">Modals</a>
</li>
<li class="asideNav-listItem" ng-class="{'is-active': isActive('/pagination.html')}">
<a class="asideNav-link" href="/pagination.html">Pagination</a>
</li>
<li class="asideNav-listItem" ng-class="{'is-active': isActive('/panels.html')}">
<a class="asideNav-link" href="/panels.html">Panels</a>
</li>
<li class="asideNav-listItem" ng-class="{'is-active': isActive('/pills.html')}">
<a class="asideNav-link" href="/pills.html">Pill Group</a>
</li>
<li class="asideNav-listItem" ng-class="{'is-active': isActive('/progress-bars.html')}">
<a class="asideNav-link" href="/progress-bars.html">Progress Bars</a>
</li>
<li class="asideNav-listItem" ng-class="{'is-active': isActive('/tabs.html')}">
<a class="asideNav-link" href="/tabs.html">Tabs</a>
</li>
<li class="asideNav-listItem" ng-class="{'is-active': isActive('/tooltips.html')}">
<a class="asideNav-link" href="/tooltips.html">Tooltips</a>
</li>
<li class="asideNav-listItem" ng-class="{'is-active': isActive('/tables.html')}">
<a class="asideNav-link" href="/tables.html">Tables</a>
</li>
</ul>
</nav>
</aside>
<main class="mainContent" role="main" ng-view>
<h1 class="mainContent-header">Modals</h1>
<p>
Modals are the metaphorical post-it note to the interactive page. They take full focus and control from the app, and demand interaction or confirmation before returning control to the user.
</p>
<section class="panel labPanel">
<h4 class="labPanel-title">Related Patterns</h4>
<ul class="u-listNoBullet labRelated-list">
<li><a href="/prompt.html">Prompt</a></li>
</ul>
</section>
<hr>
<section class="panel labPanel">
<div class="labPanel-docs">
<div class="labPanel-docsDemo">
<a href="/demo.html#/components/modal" class="button--icon demo-button" target="_blank">
View Demo <icon glyph="ic-open-in-new"></icon>
</a>
</div>
<tabset buttons="true">
<tab>
<tab-heading>Design</tab-heading>
<div class="labPanel-content demo">
<img class="labPanel-docsTabs-figure" src="images/modal_screen.png">
</div>
</tab>
<tab>
<tab-heading>HTML</tab-heading>
<div class="labPanel-content">
<textarea ui-codemirror="{
'lineNumbers': true,
'theme':'default',
'readOnly': 'true',
'lineWrapping' : false,
'mode': 'text/html',
'autoClearEmptyLines': true
}">
<div class="modal-background"></div>
<section class="modal">
<!-- The following section is taken from the template you specify -->
<div class="modal-header">
<h2 class="modal-header-title">A Modal Title</h2>
</div>
<div class="modal-body">
<h4>Some Modal Content</h4>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Inventore
necessitatibus consequuntur quo totam quos, odio impedit. Nostrum pariatur,
culpa blanditiis. Nostrum ipsam maiores sed dolores adipisci qui itaque,
commodi accusantium.
</p>
</div>
<div class="modal-footer">
<a class="modal-footer-link" ng-click="modalContentCtrl.cancel($event)" href="#">
Cancel modal
</a>
<a class="button button--small button--primary" ng-click="modalContentCtrl.ok($event)" href="#">
Primary modal action
</a>
</div>
</section></textarea>
</div>
<div class="labPanel-content">
<div class="labPanel-classDefs">
<p>
1. <code>.modal-background</code>
<ul class="u-listNoBullet">
<li>Covers entire page, including navigation, with semi-transparent overlay.</li>
<li>No actions – clicking on the <code>.modal-background</code> will not close the modal.</li>
<li>The page behind the modal background is not scrollable.</li>
<li>Fixed in height.</li>
</ul>
</p>
<p>
2. <code>.modal</code>
<ul class="u-listNoBullet">
<li>Modals have a max height. Based on variation.</li>
<li>Large modal - 640px</li>
<li>Standard modal - 580px; Once content overflows, scrolling is enabled</li>
<li>Small modal - has fluid height</li>
<li>Height dependent on modifier class.</li>
</ul>
</p>
<p>Modal Template: This markup forms the content of the modal and is not controlled by the directive.</p>
<p>
3. <code>.modal-header</code> (optional)
<ul class="u-listNoBullet">
<li>When content overflows, stays fixed to the top of the modal.</li>
</ul>
</p>
<p>
4. <code>.modal-header-title</code>
<ul class="u-listNoBullet">
<li>If <code>.modal-header</code> exists, this must be provided as well.</li>
<li>Applied to <code>h2</code> heading.</li>
</ul>
</p>
<p>
5. <code>.modal-body</code>
<ul class="u-listNoBullet">
<li>Expanded by content. Scrolls for overflow.</li>
<li>No limit to content – but be mindful of your users.</li>
</ul>
</p>
<p>
6. <code>.modal-footer</code>
<ul class="u-listNoBullet">
<li>May have up to 2 actions, at least one which closes the modal.</li>
<li>When content overflows, stays fixed to the bottom of the modal.</li>
</ul>
</p>
<p>
7. <code>.modal-footer-link</code>
<ul class="u-listNoBullet">
<li>Must be used when the action for the modal is "Cancel". If it's not, you may use a <code>button--secondary</code>.</li>
</ul>
</p>
</div>
</div>
</tab>
<tab>
<tab-heading>JS</tab-heading>
<div class="labPanel-content">
<textarea ui-codemirror="{
'lineNumbers': true,
'theme':'default',
'readOnly': 'true',
'lineWrapping' : false,
'mode': 'javascript',
'autoClearEmptyLines': true
}">$modal.open({
controller: 'ModalContentCtrl as modalContentCtrl',
templateUrl: 'src/website/js/examples/modal/modal-bc.tpl.html',
windowClass: 'modal--small'
});</textarea>
</div>
<div class="labPanel-content">
<div class="labPanel-classDefs">
<p>
The modal component is interfaced through the angular <code>$modal</code>
service. This service has only 1 method: <code>get</code>, which takes
an options object.
</p>
<h4 class="labPanel-title">Options</h4>
<p>
<code>templateUrl</code>
<p>A path to a template representing modal's content.</p>
</p>
<p>
<code>template</code>
<p>inline template representing the modal's content.</p>
</p>
<p>
<code>scope</code>
<p>a scope instance to be used for the modal's content (actually the <code>$modal</code> service is going to create a child scope of a provided scope). Defaults to <code>$rootScope.</code></p>
</p>
<p>
<code>controller</code>
<p>a controller for a modal instance - it can initialize scope used by modal. Accepts the "controller-as" syntax, and can be injected with <code>$modalInstance</code>.</p>
</p>
<p>
<code>resolve</code>
<p>members that will be resolved and passed to the controller as locals; it is equivalent of the resolve property for AngularJS routes.</p>
</p>
<p>
<code>backdrop</code>
<p>controls presence of a backdrop. Allowed values: true (default), false (no backdrop), 'static' - backdrop is present but modal window is not closed when clicking outside of the modal window.</p>
</p>
<p>
<code>keyboard</code>
<p>indicates whether the dialog should be closable by hitting the ESC key, defaults to true.</p>
</p>
<p>
<code>windowClass</code>
<p>additional CSS class(es) to be added to a modal window template. Predefined class is <code>modal--small</code>.</p>
</p>
</div>
</div>
</tab>
</tabset>
</div>
<div class="panel labPanel">
<h3 class="labPanel-heading">Accessibility</h3>
<div class="panel-body">
<p>
As per its purpose and behaviour, the modal will trap all focus. This means that all tab indexing will cycle through the modal, and focus will immediately go to the first piece of readable content. This is either the modal header, or the content.
</p>
<p>Accessibility Markup:</p>
<ul>
<li>
Modal has <code>role="dialog"</code>
</li>
<li>
When the modal is open, everything behind it has HTML attribute <code>aria-hidden="true"</code>, so assistive technology won't read out the underlying page. The best way to do this is to give the modal and the page separate wrapper elements and toggle <code>aria-hidden</code> on the main page's wrapper depending on whether or not the modal is open.
</li>
<li>
Modal contains an HTML heading, either in <code>modal-header-title</code> or <code>modal-content</code>.
</li>
<li>
Modal has an <code>aria-labelledby</code> attribute whose value is the id of the modal's heading
</li>
</ul>
<p>Keyboard interactions:</p>
<ul>
<li>
Esc key closes the modal and moves focus to whatever triggered the modal to open.
</li>
<li>
Tab key at bottom of modal cycles focus back to first focusable element at top of modal
</li>
<li>
Shift+Tab keys at top of modal cycle focus back to last focusable element at bottom of modal
</li>
<li>
Enter key submits modal's form data, if applicable
</li>
</ul>
</div>
</div>
</section>
</main>
</div>
<script src="js/vendor.js"></script>
<!-- build:patternLabJS -->
<script src="js/bcapp/bcapp-pattern-lab-all-deps.js"></script>
<script src="js/bcapp/bcapp-pattern-lab-all-templates.js"></script>
<script src="js/bcapp/bcapp-pattern-lab-components.js"></script>
<!-- endbuild -->
<!-- build:websiteJS -->
<script src="js/website/website-templates.js"></script>
<script src="js/website/website.js"></script>
<!-- endbuild -->
</body>
</html>