-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
317 lines (288 loc) · 17.3 KB
/
index.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
<!doctype html>
<html lang="en" class="b-pw-1280 b-reith-sans-font b-reith-serif-font no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="/gef-docs/static/images/favicon.ico" type="image/x-icon">
<title>GEF | Home</title>
<script src="/gef-docs/static/js/site.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css">
<link rel="stylesheet" type="text/css" href="/gef-docs/static/css/gef.css">
<link rel="stylesheet" type="text/css" href="/gef-docs/static/css/site.css">
<script type="text/javascript"> // feature detects
document.documentElement.className = document.documentElement.className.replace(' no-js', ' js');
document.documentElement.className += (' ' + ('ontouchstart' in document.documentElement ? 'touch' : 'no-touch'));
document.documentElement.className += (' ' + ('flexWrap' in document.documentElement.style ? 'flex' : 'no-flex'));
document.documentElement.className += (' ' + ((document.createElementNS && 'createSVGRect' in document.createElementNS('http://www.w3.org/2000/svg', 'svg')) ? 'svg' : 'no-svg'));
</script>
<script type="text/javascript">
try {
(new FontFaceObserver('ReithSans', 5000)).load().then(function () {
document.documentElement.className += ' b-reith-sans-loaded';
});
(new FontFaceObserver('ReithSerif', 5000)).load().then(function () {
document.documentElement.className += ' b-reith-loaded';
});
} catch( e ) {
console.log('Reith fonts did not load within 5 seconds.');
}
</script>
<script type="text/javascript">
// syntax highlight
hljs.initHighlightingOnLoad();
</script>
</head>
<body class="gefdocs-body">
<p class="gef-sr gef-sr__focusable gef-sr__overlay" tabindex="0">
<a href="#main" onfocus="this.parentNode.classList.add('gef-sr__focused')" onblur="this.parentNode.classList.remove('gef-sr__focused')">Skip
to content</a>
</p>
<header>
<div class="gefdocs-header gs-u-clearfix">
<div class="gel-wrap">
<a href="http://www.bbc.co.uk/"><svg aria-label="BBC GEL Logo" width="100" height="24" viewBox="0 0 100 24">
<title>BBC</title>
<image xlink:href="/gef-docs/static/images/bbc-blocks_grey.svg" src="/gef-docs/static/images/bbc-blocks_grey.png"
width="100%" height="100%"></image>
</svg></a>
</div>
</div>
<div class="gefdocs-header__banner gs-u-clearfix">
<div class="gel-wrap">
<div class="gel-layout">
<div class="gel-layout__item gel-2/5@l" style="text-align:left; padding-left:14px; margin-bottom:32px;">
<a href="/gef-docs/" class="gefdocs-logo">GEF</a>
</div>
<div class="gel-layout__item gel-2/5@l gel-pull__right@l" style="margin-bottom: 16px;">
<a class="gefdocs-button gefdocs-button--dark gel-long-primer-bold" href="http://www.bbc.co.uk/gel">
Go to BBC GEL
</a>
</div>
</div>
</div>
</div>
</header>
<main id="main" tabindex="-1" class="gel-wrap gs-u-clearfix">
<div class="gel-layout">
<div class="gel-layout__item gel-1/5@l">
<!-- column placeholder-->
</div>
<div class="gel-layout__item gel-2/5@l" style="padding-right: 12px;">
<h1 class="gefdocs-header__title">Home</h1>
<p class="gefdocs-header__summary gel-great-primer">Guidance for developers building accessible websites based on BBC GEL.</p>
</div>
</div>
<div class="gel-layout">
<div class="gel-layout__item gel-1/5@l">
<nav role="navigation" id="side-nav" class="gel-side-nav sticky" data-sticky-for="900" style="padding-top:32px">
<div class="gel-pica gs-u-mb gs-u-mt0">Contents</div>
<ol id="gefdocs-toc__links" class="gefdocs-toc"><li><a href="#what-gef-is">What GEF is</a></li><li><a href="#what-gef-isnt">What GEF isn't</a></li><li><a href="#coding-conventions">Coding conventions</a></li><li><a href="#whats-here">What's here?</a></li><li><a href="#questions">Questions?</a></li></ol>
</nav>
</div>
<div class="gefdocs-sections gefdocs-body-copy gel-layout__item gel-3/5@l">
<h2 id="what-gef-is">What GEF is</h2>
<p>In short: GEF sets out how to code GEL. Or, to put it another way, GEF is development to GEL's design. As a developer seeking out how to best implement a pattern defined in GEL, GEF should have you covered.</p>
<p>But what is <em>best</em>? It's something that constantly evolves according to changes in web technologies and accumulated user research. While nothing you see in GEF today is, therefore, set in stone, you can be confident is has been written with the following three concerns in mind:</p>
<ul>
<li><strong>Accessibility:</strong> The BBC and its content is for everyone. Everything in GEF is written with inclusion in mind, drawing from the accessibility community's wealth of knowledge and experience. Accessibility is not a feature of GEF, but a trait.</li>
<li><strong>Standards:</strong> GEF is deferential to web standards, and the groundwork laid by the W3C's specifications and guidelines — as well as the BBC's own <em>Mobile Accessibility Guidelines</em> and all applicable <em>BBC Standards and Guidelines</em>. GEF embraces convention, and does not fix anything unbroken.</li>
<li><strong>Research:</strong> Some aspects of standards, conventions, and other kinds of prior art may be called into question in light of research and testing data. Where research points to the need for innovation, GEF will break that new ground.</li>
</ul>
<p>GEF invites everyone to join the conversation, and help improve the guidance it offers.</p>
<h2 id="what-gef-isnt">What GEF isn't</h2>
<p>GEF is not a pattern library; it is not intended to be 'plugged in' to your interface directly. For this to be possible, it would have to dictate your environment, stack, and workflow.</p>
<p>GEF appreciates that different teams across the BBC work in different ways, with different coding styles and frameworks. Accordingly, GEF offers recommendations for what needs to be achieved, but not <em>how</em> to achieve it, or with which tools.</p>
<p>For example, one GEF doc' might expound the need for a state change, using <code>aria-pressed</code> to make it accessible. The documentation will explain why that state change is needed, how it is communicated in assistive technologies, and even offer a 'reference implementation' demonstrating it in action. But it will not assume you will be implementing that state change using Vue.js, React, a native web component, or any other 'flavour' of frontend technology. That is up to you, and your team.</p>
<h2 id="coding-conventions">Coding conventions</h2>
<p>GEF makes recommendations about the markup (HTML), layout (CSS), and behaviour (JS) of your GEL implementations. It is otherwise technology agnostic (see <a href="#what-gef-isnt">What GEF isn't</a>).</p>
<p>However, the reference implementations inside GEF adhere to certain principles and conventions. If you are intending to contribute working code to GEF, please be mindful of these.</p>
<h3 id="es5">ES5</h3>
<p>All reference implementations are written in ES5. The intention is for the code to be as widely understood, and as easily adopted for creating test cases as possible. In a few cases, small polyfills are included. These are added to the implementation's demo page inside the <code>init</code> function.</p>
<h3 id="progressive-enhancement">Progressive enhancement</h3>
<p>GEF eschews larger polyfills and compatibility libraries, opting to use feature detection. In JavaScript this might mean wrapping functionality in an <code>if</code> block.</p>
<pre class="hljs"><code><span class="hljs-keyword">if</span> (<span class="hljs-string">'IntersectionObserver'</span> <span class="hljs-keyword">in</span> <span class="hljs-built_in">window</span>) {
<span class="hljs-comment">// Do something with the IntersectionObserver API</span>
}
</code></pre>
<p>In CSS, a basic layout is put in place then enhanced with modern layout modules like CSS Grid inside <code>@supports</code> blocks:</p>
<pre class="hljs"><code><span class="hljs-selector-class">.grid</span> > * + * {
<span class="hljs-attribute">margin-top</span>: <span class="hljs-number">1rem</span>;
}
@<span class="hljs-keyword">supports</span> (display: grid) {
<span class="hljs-selector-class">.grid</span> {
<span class="hljs-attribute">display</span>: grid;
<span class="hljs-attribute">grid-template-columns</span>: <span class="hljs-built_in">repeat</span>(auto-fill, minmax(266px, 1fr));
<span class="hljs-attribute">grid-gap</span>: <span class="hljs-number">1rem</span>;
}
<span class="hljs-selector-class">.grid</span> > * + * {
<span class="hljs-attribute">margin</span>: <span class="hljs-number">0</span>; <span class="hljs-comment">/* undo, since `grid-gap` supercedes it */</span>
}
}
</code></pre>
<h3 id="name-spacing">Name spacing</h3>
<p>Components are identified in their markup using classes and the <code>gef-component</code> structure. For example, the <strong>Site menu</strong> pattern uses <code>class="gef-sitemenu"</code> on the parent element, and <code>gef-sitemenu-more</code> to identify each (hidden by default) submenu.</p>
<p>Component scripts are attached to the <code>gef</code> namespace, like <code>gef.ComponentName</code>.</p>
<h3 id="constructor-pattern">Constructor pattern</h3>
<p>Each reference implementation that depends on JavaScript uses a basic constructor pattern to instantiate the working component. For example, the simple toggle switch constructor looks like this:</p>
<pre class="hljs"><code> self.constructor = <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">button</span>) </span>{
<span class="hljs-keyword">this</span>.button = button;
<span class="hljs-comment">// The 'on/off' text is provided in an aria-hidden <span></span>
<span class="hljs-keyword">this</span>.onOffSpan = <span class="hljs-keyword">this</span>.button.querySelector(<span class="hljs-string">'[aria-hidden]'</span>);
<span class="hljs-comment">// Set aria-pressed to false if the attribute is absent</span>
<span class="hljs-keyword">let</span> currentState = <span class="hljs-keyword">this</span>.button.getAttribute(<span class="hljs-string">'aria-pressed'</span>) === <span class="hljs-string">'true'</span>;
<span class="hljs-keyword">this</span>.button.setAttribute(<span class="hljs-string">'aria-pressed'</span>, currentState);
<span class="hljs-comment">// Set the span's text to match the state</span>
<span class="hljs-keyword">this</span>.onOffSpan.textContent = currentState ? <span class="hljs-string">'on'</span> : <span class="hljs-string">'off'</span>;
<span class="hljs-comment">// Bind to the toggle method</span>
<span class="hljs-keyword">this</span>.button.addEventListener(<span class="hljs-string">'click'</span>, <span class="hljs-keyword">this</span>.toggle.bind(<span class="hljs-keyword">this</span>));
}
<span class="hljs-comment">// The toggle method</span>
self.constructor.prototype.toggle = <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
<span class="hljs-keyword">let</span> currentState = <span class="hljs-keyword">this</span>.button.getAttribute(<span class="hljs-string">'aria-pressed'</span>) === <span class="hljs-string">'true'</span>;
<span class="hljs-keyword">this</span>.button.setAttribute(<span class="hljs-string">'aria-pressed'</span>, !currentState);
<span class="hljs-keyword">this</span>.onOffSpan.textContent = currentState ? <span class="hljs-string">'off'</span> : <span class="hljs-string">'on'</span>;
}
</code></pre>
<p>Note that the <code>toggle</code> function is exposed as a public method, in case the switch needs to be toggled programmatically.</p>
<p>Initialization inside the component's GEF demo page looks like this:</p>
<pre class="hljs"><code><span class="hljs-keyword">var</span> switchElem = <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">'.gef-button-switch'</span>);
<span class="hljs-keyword">var</span> switchButton = <span class="hljs-keyword">new</span> gef.Switch.constructor(switchElem);
</code></pre>
<h2 id="whats-here">What's here?</h2>
<p>We are working our way through a list based closely on what's already published in <a href="http://www.bbc.co.uk/gel/">the BBC GEL Guidelines</a>. You should generally start there when seeking to understand any documented pattern but at the point where you're wondering about which HTML tags to use we're here for you!</p>
<table>
<thead>
<tr>
<th>Component</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="/gef-docs/components/accordions/">Accordions</a></td>
<td>Draft / Pending</td>
</tr>
<tr>
<td><a href="/gef-docs/components/action-dialogs/">Action dialogs</a></td>
<td>Draft / Pending</td>
</tr>
<tr>
<td><a href="/gef-docs/components/breakout-boxes/">Breakout boxes</a></td>
<td>Draft / Pending</td>
</tr>
<tr>
<td><a href="/gef-docs/components/buttons-and-ctas/">Buttons and CTAs</a></td>
<td>Draft / Pending</td>
</tr>
<tr>
<td><a href="/gef-docs/components/cards/">Cards</a></td>
<td>Draft / Pending</td>
</tr>
<tr>
<td><a href="/gef-docs/components/carousels/">Carousels</a></td>
<td>Draft / Pending</td>
</tr>
<tr>
<td><a href="/gef-docs/components/external-links/">External links</a></td>
<td>Draft / Pending</td>
</tr>
<tr>
<td><a href="/gef-docs/components/metadata-strips/">Metadata strips</a></td>
<td>Draft / Pending</td>
</tr>
<tr>
<td><a href="/gef-docs/components/headings/">Headings</a></td>
<td>Draft / Pending</td>
</tr>
<tr>
<td><a href="/gef-docs/components/promos/">Promos</a></td>
<td>Draft / Pending</td>
</tr>
<tr>
<td><a href="/gef-docs/components/tabs/">Tabs</a></td>
<td>Draft / Pending</td>
</tr>
<tr>
<td><a href="/gef-docs/components/form-fields/">Form fields and validation</a></td>
<td>Draft / Pending</td>
</tr>
<tr>
<td><a href="/gef-docs/components/video-controls/">Video controls</a></td>
<td>Draft / Pending</td>
</tr>
<tr>
<td><a href="/gef-docs/components/pockets/">Pocket</a></td>
<td>Draft / Pending</td>
</tr>
<tr>
<td><a href="/gef-docs/components/load-more/">Pagination</a></td>
<td>Draft / Pending</td>
</tr>
<tr>
<td><a href="/gef-docs/components/info-panels/">Information Panel</a></td>
<td>Draft / Pending</td>
</tr>
<tr>
<td><a href="/gef-docs/components/share-tools/">Share Tools</a></td>
<td>Draft / Pending</td>
</tr>
<tr>
<td><a href="/gef-docs/components/site-menu/">Site Menu</a></td>
<td>Draft / Pending</td>
</tr>
<tr>
<td><a href="/gef-docs/atoms/grids/">Grids</a></td>
<td>Draft / Pending</td>
</tr>
<tr>
<td><a href="/gef-docs/atoms/headings/">Headings</a></td>
<td>Draft / Pending</td>
</tr>
<tr>
<td><a href="/gef-docs/atoms/iconography/">Icons</a></td>
<td>Draft / Pending</td>
</tr>
<tr>
<td><a href="/gef-docs/atoms/typography/">Type</a></td>
<td>Draft / Pending</td>
</tr>
</tbody>
</table>
<h2 id="questions">Questions?</h2>
<p>This project is currently being overseen by the BBC Accessibility Team, managed by Gareth Ford Williams. If you have access to our corporate Slack channel pop in and say hi. We welcome questions and suggestions posted to the GEF Docs GitHub issue tracker.</p>
</div>
</div>
</main>
<div class="gefdocs-feedback-banner">
<div class="gel-wrap">
<div class="gel-layout">
<div class="gel-layout__item gel-2/3@l gel-3/5@xl">
<h2 class="gefdocs-feedback-banner__title">Got a minute?</h2>
<p>We'd love to know what you think of the Code GEL website.</p>
<a href="https://www.smartsurvey.co.uk/s/gel-website-feedback/" class="gefdocs-button gefdocs-button__link-button gefdocs-feedback-banner__cta gefdocs-button--primary">
<span class="gefdocs-button__content">Go to survey</span>
<span class="gefdocs-button__icon_wrapper">
<svg class="gefdocs-button__icon gefdocs-icon gefdocs-icon--text">
<use xlink:href="/gef-docs/static/images/gel-icons-core-set.svg#gel-icon-external-link"
style="fill:undefined;"></use>
</svg>
</span>
</a>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="/gef-docs/static/js/gef.js"></script>
<script type="text/javascript">
new Sticky('.sticky');
new MenuSpy(document.querySelector('#gefdocs-toc__links'), {enableLocationHash: false});
new SweetScroll({
trigger: '#gefdocs-toc__links a',
quickMode: true,
easing: 'easeOutExpo',
cancellable: true,
updateURL: false,
});
</script>
</body>
</html>