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
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
ash / webui / common / resources / keyboard_diagram.html [blame]
<style>
:host {
--diagram-bg-color: var(--cros-bg-color);
--grid-gap: 4px;
--key-travel: 3px;
--rows: minmax(18px, 1fr) repeat(5, 2fr);
}
#keyboard {
column-gap: var(--grid-gap);
/*
* Noto Sans Arabic has to be specified for certain Arabic diacritics to
* display properly.
*/
font-family: 'Noto Sans Arabic', 'Noto Sans', sans-serif;
height: 250px; /* Overriden by JavaScript */
line-height: 13px;
width: 100%;
}
.main-cluster {
display: inline-grid;
grid-gap: var(--grid-gap);
grid-template-columns: repeat(29, 1fr);
grid-template-rows: var(--rows);
height: 100%;
width: 100%;
}
keyboard-key {
--keyboard-key-travel: var(--key-travel);
grid-column: span 2;
}
#topRow {
column-gap: var(--grid-gap);
display: flex;
grid-column: 1 / -1;
}
#topRow keyboard-key {
flex-basis: 0;
flex-grow: 1;
}
#arrowKeyCluster {
display: grid;
grid-column: span 6;
grid-gap: var(--grid-gap);
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(2, 1fr);
}
#arrowKeyCluster keyboard-key {
grid-column: span 1;
grid-row: 2;
}
#arrowKeyCluster #upArrow {
grid-column: 2;
grid-row: 1;
}
/* Default (ANSI) key sizes */
#backspaceKey,
#tabKey,
#enterKey {
grid-column: span 3;
}
#launcherKey,
#rightShiftKey,
#leftAltKey {
grid-column: span 4;
}
#leftShiftKey,
#leftCtrlKey {
grid-column: span 5;
}
#spacebar {
grid-column: span 10;
}
/*
* On ISO and JIS, the Enter key is L-shaped (with the backslash key moved
* down one row). To achieve this with elements that fit in the grid, two
* separate elements are placed on the grid, with their corners and
* positioning tweaked to make them look like one key.
*/
[data-mech-layout='iso'] #enterKey,
[data-mech-layout='jis'] #enterKey {
--keyboard-key-bottom-right-radius: 0;
grid-column: 28 / -1;
grid-row: 3;
}
#enterKeyLowerPart {
display: none;
}
[data-mech-layout='iso'] #enterKeyLowerPart,
[data-mech-layout='jis'] #enterKeyLowerPart {
--keyboard-key-border-top-width: 0;
--keyboard-key-top-radii: 0;
display: block;
grid-column: 29 / -1;
/*
* Expand the element upwards so that it overlaps the grid gap, key travel
* area, and border of the actual Enter key on the row above.
*/
margin-top: calc(-1 * var(--grid-gap) - var(--key-travel) - 1px);
}
[data-mech-layout='iso'] #backslashKey,
[data-mech-layout='jis'] #backslashKey {
grid-column: 27 / span 2;
grid-row: 4;
}
/* Modifications for ISO */
#isoKey {
display: none;
}
[data-mech-layout='iso'] #isoKey {
display: block;
}
[data-mech-layout='iso'] #leftShiftKey {
grid-column: span 3;
}
/* Modifications for JIS */
.jis-only {
display: none;
}
[data-mech-layout='jis'] .jis-only {
display: block;
}
/*
* JIS crams in a few more keys, most notably an additional one on the number
* row, so a 30-column grid makes more sense for it.
*/
.main-cluster[data-mech-layout='jis'] {
grid-template-columns: repeat(30, 1fr);
}
[data-mech-layout='jis'] #backspaceKey {
grid-column: span 2;
}
[data-mech-layout='jis'] #spacebar {
grid-column: span 6;
}
[data-mech-layout='jis'] #rightShiftKey {
grid-column: span 3;
}
[data-mech-layout='jis'] #arrowKeyCluster {
grid-column: span 7;
}
/* Modifications for Dell Enterprise keyboards */
[data-show-fn-and-globe-keys] #leftCtrlKey {
grid-column: span 3;
}
[data-show-fn-and-globe-keys] #leftAltKey {
grid-column: span 2;
}
#arrowKeyCluster #dellPageUpKey,
#arrowKeyCluster #dellPageDownKey {
grid-row: 1;
}
#layoutSwitchKey {
--keyboard-key-icon-size: 60%;
}
/* Modifications for Assistant key */
[data-show-assistant-key] #leftCtrlKey {
grid-column: span 3;
}
/* Number pad */
#numberPad {
display: none;
}
[data-show-number-pad] .main-cluster {
width: 77%;
}
[data-show-number-pad] #numberPad {
box-sizing: border-box;
display: inline-grid;
grid-gap: var(--grid-gap);
grid-template-columns: repeat(4, 1fr);
grid-template-rows: var(--rows);
height: 100%;
/*
* The number pad will always be on the right, even in RTL locales, so
* disable the lint warning.
*/
padding-left: /* csschecker-disable-line left-right */
calc(var(--grid-gap) * 3);
width: 23%;
}
#numberPad keyboard-key {
grid-column: span 1;
}
#numberPad .double-height {
grid-row: span 2;
}
#numberPad .double-width {
grid-column: span 2;
}
</style>
<div id="widthChangeDetector">
<!--
We don't want to both observe and modify the size of #keyboard, so instead
we observe the size of this empty element, which will change widths at the
same time as #keyboard.
-->
</div>
<div id="keyboard"
data-show-number-pad$="[[showNumberPad]]">
<div class="main-cluster"
data-mech-layout$="[[mechanicalLayout]]"
data-show-assistant-key$="[[showAssistantKey]]"
data-show-fn-and-globe-keys$="[[showFnAndGlobeKeys_]]">
<!--
Most keys aren't labelled here, as their glyphs are set from the
appropriate layout in keyboard_layouts.js. The exceptions are keys that
have the same labels on all (or almost all) layouts on which they are
present.
-->
<div id="topRow">
<keyboard-key main-glyph="esc" data-code="1"></keyboard-key>
<dom-repeat items="[[topRowKeys]]" as="key">
<template>
<keyboard-key
icon="[[key.icon]]"
main-glyph="[[key.text]]"
aria-name="[[optionalI18n_(key.ariaNameI18n)]]">
</keyboard-key>
</template>
</dom-repeat>
<keyboard-key id="topRightKey" class="disabled">
</keyboard-key>
</div>
<keyboard-key data-code="41"></keyboard-key>
<keyboard-key data-code="2"></keyboard-key>
<keyboard-key data-code="3"></keyboard-key>
<keyboard-key data-code="4"></keyboard-key>
<keyboard-key data-code="5"></keyboard-key>
<keyboard-key data-code="6"></keyboard-key>
<keyboard-key data-code="7"></keyboard-key>
<keyboard-key data-code="8"></keyboard-key>
<keyboard-key data-code="9"></keyboard-key>
<keyboard-key data-code="10"></keyboard-key>
<keyboard-key data-code="11"></keyboard-key>
<keyboard-key data-code="12"></keyboard-key>
<keyboard-key data-code="13"></keyboard-key>
<keyboard-key id="jisYenKey" class="jis-only" data-code="124">
</keyboard-key>
<keyboard-key
id="backspaceKey"
class="right"
icon="keyboard:backspace"
data-code="14"
aria-name="[[i18n('keyboardDiagramAriaNameBackspace')]]">
</keyboard-key>
<keyboard-key
id="tabKey"
class="left"
icon="keyboard:tab"
data-code="15"
aria-name="[[i18n('keyboardDiagramAriaNameTab')]]">
</keyboard-key>
<keyboard-key data-code="16"></keyboard-key>
<keyboard-key data-code="17"></keyboard-key>
<keyboard-key data-code="18"></keyboard-key>
<keyboard-key data-code="19"></keyboard-key>
<keyboard-key data-code="20"></keyboard-key>
<keyboard-key data-code="21"></keyboard-key>
<keyboard-key data-code="22"></keyboard-key>
<keyboard-key data-code="23"></keyboard-key>
<keyboard-key data-code="24"></keyboard-key>
<keyboard-key data-code="25"></keyboard-key>
<keyboard-key data-code="26"></keyboard-key>
<keyboard-key data-code="27"></keyboard-key>
<keyboard-key id="backslashKey" data-code="43"></keyboard-key>
<keyboard-key
id="launcherKey"
class="left"
icon="keyboard:launcher"
data-code="125"
aria-name="[[i18n('keyboardDiagramAriaNameLauncher')]]">
</keyboard-key>
<keyboard-key data-code="30"></keyboard-key>
<keyboard-key data-code="31"></keyboard-key>
<keyboard-key data-code="32"></keyboard-key>
<keyboard-key data-code="33"></keyboard-key>
<keyboard-key data-code="34"></keyboard-key>
<keyboard-key data-code="35"></keyboard-key>
<keyboard-key data-code="36"></keyboard-key>
<keyboard-key data-code="37"></keyboard-key>
<keyboard-key data-code="38"></keyboard-key>
<keyboard-key data-code="39"></keyboard-key>
<keyboard-key data-code="40"></keyboard-key>
<keyboard-key
id="enterKey"
class="right"
icon="keyboard:return"
data-code="28"
aria-name="[[i18n('keyboardDiagramAriaNameEnter')]]">
</keyboard-key>
<keyboard-key id="enterKeyLowerPart" data-code="28" aria-hidden="true"></keyboard-key>
<keyboard-key
id="leftShiftKey"
class="left"
icon="keyboard:shift"
data-code="42"
aria-name="[[i18n('keyboardDiagramAriaNameShiftLeft')]]">
</keyboard-key>
<keyboard-key
id="isoKey"
bottom-left-glyph="<"
top-left-glyph=">"
data-code="86">
</keyboard-key>
<keyboard-key data-code="44"></keyboard-key>
<keyboard-key data-code="45"></keyboard-key>
<keyboard-key data-code="46"></keyboard-key>
<keyboard-key data-code="47"></keyboard-key>
<keyboard-key data-code="48"></keyboard-key>
<keyboard-key data-code="49"></keyboard-key>
<keyboard-key data-code="50"></keyboard-key>
<keyboard-key data-code="51"></keyboard-key>
<keyboard-key data-code="52"></keyboard-key>
<keyboard-key data-code="53"></keyboard-key>
<keyboard-key id="jisBackslashKey" class="jis-only" data-code="89"></keyboard-key>
<keyboard-key
id="rightShiftKey"
class="right"
icon="keyboard:shift"
data-code="54"
aria-name="[[i18n('keyboardDiagramAriaNameShiftRight')]]">
</keyboard-key>
<keyboard-key id="leftCtrlKey" class="left" main-glyph="ctrl" data-code="29"></keyboard-key>
<template is="dom-if" if="[[showFnAndGlobeKeys_]]">
<keyboard-key id="fnKey" class="disabled" main-glyph="fn"></keyboard-key>
<keyboard-key
id="layoutSwitchKey"
icon="keyboard:layout-switch"
data-code="584"
aria-name="[[i18n('keyboardDiagramAriaNameLayoutSwitch')]]">
</keyboard-key>
</template>
<template is="dom-if" if="[[showAssistantKey]]">
<keyboard-key
icon="keyboard:assistant"
data-code="583"
aria-name="[[i18n('keyboardDiagramAriaNameAssistant')]]">
</keyboard-key>
</template>
<keyboard-key id="leftAltKey" class="left" main-glyph="alt" data-code="56"></keyboard-key>
<keyboard-key
id="jisAlphanumericKey"
class="jis-only"
main-glyph="英数"
data-code="94">
</keyboard-key>
<keyboard-key id="spacebar" main-glyph="" data-code="57"></keyboard-key>
<keyboard-key
id="jisKanaKey"
class="jis-only"
main-glyph="かな"
data-code="92">
</keyboard-key>
<keyboard-key id="rightAltKey" main-glyph="alt" data-code="100"></keyboard-key>
<keyboard-key id="rightCtrlKey" main-glyph="ctrl" data-code="97"></keyboard-key>
<div id="arrowKeyCluster">
<template is="dom-if"
if="[[isEqual_(physicalLayout, 'dell-enterprise-wilco')]]">
<keyboard-key id="dellPageUpKey" main-glyph="pg up" data-code="104"></keyboard-key>
</template>
<keyboard-key
id="upArrow"
icon="keyboard:arrow-up"
data-code="103"
aria-name="[[i18n('keyboardDiagramAriaNameArrowUp')]]">
</keyboard-key>
<template is="dom-if"
if="[[isEqual_(physicalLayout, 'dell-enterprise-wilco')]]">
<keyboard-key id="dellPageDownKey" main-glyph="pg dn" data-code="109"></keyboard-key>
</template>
<keyboard-key
icon="keyboard:arrow-left"
data-code="105"
aria-name="[[i18n('keyboardDiagramAriaNameArrowLeft')]]">
</keyboard-key>
<keyboard-key
icon="keyboard:arrow-down"
data-code="108"
aria-name="[[i18n('keyboardDiagramAriaNameArrowDown')]]">
</keyboard-key>
<keyboard-key
icon="keyboard:arrow-right"
data-code="106"
aria-name="[[i18n('keyboardDiagramAriaNameArrowRight')]]">
</keyboard-key>
</div>
</div>
<div id="numberPad">
<keyboard-key main-glyph="page up" data-code="104"></keyboard-key>
<keyboard-key main-glyph="page dn" data-code="109"></keyboard-key>
<keyboard-key main-glyph="home" data-code="102"></keyboard-key>
<keyboard-key main-glyph="end" data-code="107"></keyboard-key>
<keyboard-key main-glyph="delete" data-code="111"></keyboard-key>
<keyboard-key main-glyph="/" data-code="98"></keyboard-key>
<keyboard-key main-glyph="*" data-code="55"></keyboard-key>
<keyboard-key main-glyph="-" data-code="74"></keyboard-key>
<keyboard-key main-glyph="7" data-code="71"></keyboard-key>
<keyboard-key main-glyph="8" data-code="72"></keyboard-key>
<keyboard-key main-glyph="9" data-code="73"></keyboard-key>
<keyboard-key class="double-height" main-glyph="+" data-code="78"></keyboard-key>
<keyboard-key main-glyph="4" data-code="75"></keyboard-key>
<keyboard-key main-glyph="5" data-code="76"></keyboard-key>
<keyboard-key main-glyph="6" data-code="77"></keyboard-key>
<keyboard-key main-glyph="1" data-code="79"></keyboard-key>
<keyboard-key main-glyph="2" data-code="80"></keyboard-key>
<keyboard-key main-glyph="3" data-code="81"></keyboard-key>
<keyboard-key class="double-height" main-glyph="enter" data-code="96"></keyboard-key>
<keyboard-key class="double-width" main-glyph="0" data-code="82"></keyboard-key>
<keyboard-key main-glyph="." data-code="83"></keyboard-key>
</div>
</div>