-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathindex.html
1599 lines (1511 loc) · 91.7 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
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
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html><html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Keyboard Map</title>
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
<link href="https://www.w3.org/StyleSheets/TR/2021/cg-draft" rel="stylesheet">
<meta content="Bikeshed version 511ccb7, updated Mon Jun 6 13:31:59 2022 -0700" name="generator">
<link href="https://wicg.github.io/keyboard-map/" rel="canonical">
<style>/* style-autolinks */
.css.css, .property.property, .descriptor.descriptor {
color: var(--a-normal-text);
font-size: inherit;
font-family: inherit;
}
.css::before, .property::before, .descriptor::before {
content: "‘";
}
.css::after, .property::after, .descriptor::after {
content: "’";
}
.property, .descriptor {
/* Don't wrap property and descriptor names */
white-space: nowrap;
}
.type { /* CSS value <type> */
font-style: italic;
}
pre .property::before, pre .property::after {
content: "";
}
[data-link-type="property"]::before,
[data-link-type="propdesc"]::before,
[data-link-type="descriptor"]::before,
[data-link-type="value"]::before,
[data-link-type="function"]::before,
[data-link-type="at-rule"]::before,
[data-link-type="selector"]::before,
[data-link-type="maybe"]::before {
content: "‘";
}
[data-link-type="property"]::after,
[data-link-type="propdesc"]::after,
[data-link-type="descriptor"]::after,
[data-link-type="value"]::after,
[data-link-type="function"]::after,
[data-link-type="at-rule"]::after,
[data-link-type="selector"]::after,
[data-link-type="maybe"]::after {
content: "’";
}
[data-link-type].production::before,
[data-link-type].production::after,
.prod [data-link-type]::before,
.prod [data-link-type]::after {
content: "";
}
[data-link-type=element],
[data-link-type=element-attr] {
font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;
font-size: .9em;
}
[data-link-type=element]::before { content: "<" }
[data-link-type=element]::after { content: ">" }
[data-link-type=biblio] {
white-space: pre;
}</style>
<style>/* style-colors */
/* Any --*-text not paired with a --*-bg is assumed to have a transparent bg */
:root {
color-scheme: light dark;
--text: black;
--bg: white;
--unofficial-watermark: url(https://www.w3.org/StyleSheets/TR/2016/logos/UD-watermark);
--logo-bg: #1a5e9a;
--logo-active-bg: #c00;
--logo-text: white;
--tocnav-normal-text: #707070;
--tocnav-normal-bg: var(--bg);
--tocnav-hover-text: var(--tocnav-normal-text);
--tocnav-hover-bg: #f8f8f8;
--tocnav-active-text: #c00;
--tocnav-active-bg: var(--tocnav-normal-bg);
--tocsidebar-text: var(--text);
--tocsidebar-bg: #f7f8f9;
--tocsidebar-shadow: rgba(0,0,0,.1);
--tocsidebar-heading-text: hsla(203,20%,40%,.7);
--toclink-text: var(--text);
--toclink-underline: #3980b5;
--toclink-visited-text: var(--toclink-text);
--toclink-visited-underline: #054572;
--heading-text: #005a9c;
--hr-text: var(--text);
--algo-border: #def;
--del-text: red;
--del-bg: transparent;
--ins-text: #080;
--ins-bg: transparent;
--a-normal-text: #034575;
--a-normal-underline: #bbb;
--a-visited-text: var(--a-normal-text);
--a-visited-underline: #707070;
--a-hover-bg: rgba(75%, 75%, 75%, .25);
--a-active-text: #c00;
--a-active-underline: #c00;
--blockquote-border: silver;
--blockquote-bg: transparent;
--blockquote-text: currentcolor;
--issue-border: #e05252;
--issue-bg: #fbe9e9;
--issue-text: var(--text);
--issueheading-text: #831616;
--example-border: #e0cb52;
--example-bg: #fcfaee;
--example-text: var(--text);
--exampleheading-text: #574b0f;
--note-border: #52e052;
--note-bg: #e9fbe9;
--note-text: var(--text);
--noteheading-text: hsl(120, 70%, 30%);
--notesummary-underline: silver;
--assertion-border: #aaa;
--assertion-bg: #eee;
--assertion-text: black;
--advisement-border: orange;
--advisement-bg: #fec;
--advisement-text: var(--text);
--advisementheading-text: #b35f00;
--warning-border: red;
--warning-bg: hsla(40,100%,50%,0.95);
--warning-text: var(--text);
--amendment-border: #330099;
--amendment-bg: #F5F0FF;
--amendment-text: var(--text);
--amendmentheading-text: #220066;
--def-border: #8ccbf2;
--def-bg: #def;
--def-text: var(--text);
--defrow-border: #bbd7e9;
--datacell-border: silver;
--indexinfo-text: #707070;
--indextable-hover-text: black;
--indextable-hover-bg: #f7f8f9;
--outdatedspec-bg: rgba(0, 0, 0, .5);
--outdatedspec-text: black;
--outdated-bg: maroon;
--outdated-text: white;
--outdated-shadow: red;
--editedrec-bg: darkorange;
}</style>
<style>/* style-counters */
body {
counter-reset: example figure issue;
}
.issue {
counter-increment: issue;
}
.issue:not(.no-marker)::before {
content: "Issue " counter(issue);
}
.example {
counter-increment: example;
}
.example:not(.no-marker)::before {
content: "Example " counter(example);
}
.invalid.example:not(.no-marker)::before,
.illegal.example:not(.no-marker)::before {
content: "Invalid Example" counter(example);
}
figcaption {
counter-increment: figure;
}
figcaption:not(.no-marker)::before {
content: "Figure " counter(figure) " ";
}</style>
<style>/* style-dfn-panel */
:root {
--dfnpanel-bg: #ddd;
--dfnpanel-text: var(--text);
}
.dfn-panel {
position: absolute;
z-index: 35;
height: auto;
width: -webkit-fit-content;
width: fit-content;
max-width: 300px;
max-height: 500px;
overflow: auto;
padding: 0.5em 0.75em;
font: small Helvetica Neue, sans-serif, Droid Sans Fallback;
background: var(--dfnpanel-bg);
color: var(--dfnpanel-text);
border: outset 0.2em;
}
.dfn-panel:not(.on) { display: none; }
.dfn-panel * { margin: 0; padding: 0; text-indent: 0; }
.dfn-panel > b { display: block; }
.dfn-panel a { color: var(--dfnpanel-text); }
.dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; }
.dfn-panel > b + b { margin-top: 0.25em; }
.dfn-panel ul { padding: 0; }
.dfn-panel li { list-style: inside; }
.dfn-panel.activated {
display: inline-block;
position: fixed;
left: .5em;
bottom: 2em;
margin: 0 auto;
max-width: calc(100vw - 1.5em - .4em - .5em);
max-height: 30vh;
}
.dfn-paneled { cursor: pointer; }
</style>
<style>/* style-issues */
a[href].issue-return {
float: right;
float: inline-end;
color: var(--issueheading-text);
font-weight: bold;
text-decoration: none;
}
</style>
<style>/* style-md-lists */
/* This is a weird hack for me not yet following the commonmark spec
regarding paragraph and lists. */
[data-md] > :first-child {
margin-top: 0;
}
[data-md] > :last-child {
margin-bottom: 0;
}</style>
<style>/* style-mdn-anno */
@media (max-width: 767px) { .mdn-anno { opacity: .1 } }
.mdn-anno { font: 1em sans-serif; padding: 0.3em; position: absolute; z-index: 8; right: 0.3em; background: #EEE; color: black; box-shadow: 0 0 3px #999; overflow: hidden; border-collapse: initial; border-spacing: initial; min-width: 9em; max-width: min-content; white-space: nowrap; word-wrap: normal; hyphens: none}
.mdn-anno:not(.wrapped) { opacity: 1}
.mdn-anno:hover { z-index: 9 }
.mdn-anno.wrapped { min-width: 0 }
.mdn-anno.wrapped > :not(button) { display: none; }
.mdn-anno > .mdn-anno-btn { cursor: pointer; border: none; color: #000; background: transparent; margin: -8px; float: right; padding: 10px 8px 8px 8px; outline: none; }
.mdn-anno > .mdn-anno-btn > .less-than-two-engines-flag { color: red; padding-right: 2px; }
.mdn-anno > .mdn-anno-btn > .all-engines-flag { color: green; padding-right: 2px; }
.mdn-anno > .mdn-anno-btn > span { color: #fff; background-color: #000; font-weight: normal; font-family: zillaslab, Palatino, "Palatino Linotype", serif; padding: 2px 3px 0px 3px; line-height: 1.3em; vertical-align: top; }
.mdn-anno > .feature { margin-top: 20px; }
.mdn-anno > .feature:not(:first-of-type) { border-top: 1px solid #999; margin-top: 6px; padding-top: 2px; }
.mdn-anno > .feature > .less-than-two-engines-text { color: red }
.mdn-anno > .feature > .all-engines-text { color: green }
.mdn-anno > .feature > p { font-size: .75em; margin-top: 6px; margin-bottom: 0; }
.mdn-anno > .feature > p + p { margin-top: 3px; }
.mdn-anno > .feature > .support { display: block; font-size: 0.6em; margin: 0; padding: 0; margin-top: 2px }
.mdn-anno > .feature > .support + div { padding-top: 0.5em; }
.mdn-anno > .feature > .support > hr { display: block; border: none; border-top: 1px dotted #999; padding: 3px 0px 0px 0px; margin: 2px 3px 0px 3px; }
.mdn-anno > .feature > .support > hr::before { content: ""; }
.mdn-anno > .feature > .support > span { padding: 0.2em 0; display: block; display: table; }
.mdn-anno > .feature > .support > span.no { color: #CCCCCC; filter: grayscale(100%); }
.mdn-anno > .feature > .support > span.no::before { opacity: 0.5; }
.mdn-anno > .feature > .support > span:first-of-type { padding-top: 0.5em; }
.mdn-anno > .feature > .support > span > span { padding: 0 0.5em; display: table-cell; }
.mdn-anno > .feature > .support > span > span:first-child { width: 100%; }
.mdn-anno > .feature > .support > span > span:last-child { width: 100%; white-space: pre; padding: 0; }
.mdn-anno > .feature > .support > span::before { content: ' '; display: table-cell; min-width: 1.5em; height: 1.5em; background: no-repeat center center; background-size: contain; text-align: right; font-size: 0.75em; font-weight: bold; }
.mdn-anno > .feature > .support > .chrome_android::before { background-image: url(https://resources.whatwg.org/browser-logos/chrome.svg); }
.mdn-anno > .feature > .support > .firefox_android::before { background-image: url(https://resources.whatwg.org/browser-logos/firefox.png); }
.mdn-anno > .feature > .support > .chrome::before { background-image: url(https://resources.whatwg.org/browser-logos/chrome.svg); }
.mdn-anno > .feature > .support > .edge_blink::before { background-image: url(https://resources.whatwg.org/browser-logos/edge.svg); }
.mdn-anno > .feature > .support > .edge::before { background-image: url(https://resources.whatwg.org/browser-logos/edge_legacy.svg); }
.mdn-anno > .feature > .support > .firefox::before { background-image: url(https://resources.whatwg.org/browser-logos/firefox.png); }
.mdn-anno > .feature > .support > .ie::before { background-image: url(https://resources.whatwg.org/browser-logos/ie.png); }
.mdn-anno > .feature > .support > .safari_ios::before { background-image: url(https://resources.whatwg.org/browser-logos/safari-ios.svg); }
.mdn-anno > .feature > .support > .nodejs::before { background-image: url(https://nodejs.org/static/images/favicons/favicon.ico); }
.mdn-anno > .feature > .support > .opera_android::before { background-image: url(https://resources.whatwg.org/browser-logos/opera.svg); }
.mdn-anno > .feature > .support > .opera::before { background-image: url(https://resources.whatwg.org/browser-logos/opera.svg); }
.mdn-anno > .feature > .support > .safari::before { background-image: url(https://resources.whatwg.org/browser-logos/safari.png); }
.mdn-anno > .feature > .support > .samsunginternet_android::before { background-image: url(https://resources.whatwg.org/browser-logos/samsung.svg); }
.mdn-anno > .feature > .support > .webview_android::before { background-image: url(https://resources.whatwg.org/browser-logos/android-webview.png); }
.name-slug-mismatch { color: red }
.caniuse-status:hover { z-index: 9; }
/* dt, li, .issue, .note, and .example are "position: relative", so to put annotation at right margin, must move to right of containing block */
.h-entry:not(.status-LS) dt > .mdn-anno, .h-entry:not(.status-LS) li > .mdn-anno, .h-entry:not(.status-LS) .issue > .mdn-anno, .h-entry:not(.status-LS) .note > .mdn-anno, .h-entry:not(.status-LS) .example > .mdn-anno { right: -6.7em; }
.h-entry p + .mdn-anno { margin-top: 0; }
h2 + .mdn-anno.after { margin: -48px 0 0 0; }
h3 + .mdn-anno.after { margin: -46px 0 0 0; }
h4 + .mdn-anno.after { margin: -42px 0 0 0; }
h5 + .mdn-anno.after { margin: -40px 0 0 0; }
h6 + .mdn-anno.after { margin: -40px 0 0 0; }
</style>
<style>/* style-selflinks */
:root {
--selflink-text: white;
--selflink-bg: gray;
--selflink-hover-text: black;
}
.heading, .issue, .note, .example, li, dt {
position: relative;
}
a.self-link {
position: absolute;
top: 0;
left: calc(-1 * (3.5rem - 26px));
width: calc(3.5rem - 26px);
height: 2em;
text-align: center;
border: none;
transition: opacity .2s;
opacity: .5;
}
a.self-link:hover {
opacity: 1;
}
.heading > a.self-link {
font-size: 83%;
}
li > a.self-link {
left: calc(-1 * (3.5rem - 26px) - 2em);
}
dfn > a.self-link {
top: auto;
left: auto;
opacity: 0;
width: 1.5em;
height: 1.5em;
background: var(--selflink-bg);
color: var(--selflink-text);
font-style: normal;
transition: opacity .2s, background-color .2s, color .2s;
}
dfn:hover > a.self-link {
opacity: 1;
}
dfn > a.self-link:hover {
color: var(--selflink-hover-text);
}
a.self-link::before { content: "¶"; }
.heading > a.self-link::before { content: "§"; }
dfn > a.self-link::before { content: "#"; }
</style>
<style>/* style-syntax-highlighting */
pre.idl.highlight {
background: var(--borderedblock-bg, var(--def-bg));
}
code.highlight { padding: .1em; border-radius: .3em; }
pre.highlight, pre > code.highlight { display: block; padding: 1em; margin: .5em 0; overflow: auto; border-radius: 0; }
.highlight:not(.idl) { background: rgba(0, 0, 0, .03); }
c-[a] { color: #990055 } /* Keyword.Declaration */
c-[b] { color: #990055 } /* Keyword.Type */
c-[c] { color: #708090 } /* Comment */
c-[d] { color: #708090 } /* Comment.Multiline */
c-[e] { color: #0077aa } /* Name.Attribute */
c-[f] { color: #669900 } /* Name.Tag */
c-[g] { color: #222222 } /* Name.Variable */
c-[k] { color: #990055 } /* Keyword */
c-[l] { color: #000000 } /* Literal */
c-[m] { color: #000000 } /* Literal.Number */
c-[n] { color: #0077aa } /* Name */
c-[o] { color: #999999 } /* Operator */
c-[p] { color: #999999 } /* Punctuation */
c-[s] { color: #a67f59 } /* Literal.String */
c-[t] { color: #a67f59 } /* Literal.String.Single */
c-[u] { color: #a67f59 } /* Literal.String.Double */
c-[cp] { color: #708090 } /* Comment.Preproc */
c-[c1] { color: #708090 } /* Comment.Single */
c-[cs] { color: #708090 } /* Comment.Special */
c-[kc] { color: #990055 } /* Keyword.Constant */
c-[kn] { color: #990055 } /* Keyword.Namespace */
c-[kp] { color: #990055 } /* Keyword.Pseudo */
c-[kr] { color: #990055 } /* Keyword.Reserved */
c-[ld] { color: #000000 } /* Literal.Date */
c-[nc] { color: #0077aa } /* Name.Class */
c-[no] { color: #0077aa } /* Name.Constant */
c-[nd] { color: #0077aa } /* Name.Decorator */
c-[ni] { color: #0077aa } /* Name.Entity */
c-[ne] { color: #0077aa } /* Name.Exception */
c-[nf] { color: #0077aa } /* Name.Function */
c-[nl] { color: #0077aa } /* Name.Label */
c-[nn] { color: #0077aa } /* Name.Namespace */
c-[py] { color: #0077aa } /* Name.Property */
c-[ow] { color: #999999 } /* Operator.Word */
c-[mb] { color: #000000 } /* Literal.Number.Bin */
c-[mf] { color: #000000 } /* Literal.Number.Float */
c-[mh] { color: #000000 } /* Literal.Number.Hex */
c-[mi] { color: #000000 } /* Literal.Number.Integer */
c-[mo] { color: #000000 } /* Literal.Number.Oct */
c-[sb] { color: #a67f59 } /* Literal.String.Backtick */
c-[sc] { color: #a67f59 } /* Literal.String.Char */
c-[sd] { color: #a67f59 } /* Literal.String.Doc */
c-[se] { color: #a67f59 } /* Literal.String.Escape */
c-[sh] { color: #a67f59 } /* Literal.String.Heredoc */
c-[si] { color: #a67f59 } /* Literal.String.Interpol */
c-[sx] { color: #a67f59 } /* Literal.String.Other */
c-[sr] { color: #a67f59 } /* Literal.String.Regex */
c-[ss] { color: #a67f59 } /* Literal.String.Symbol */
c-[vc] { color: #0077aa } /* Name.Variable.Class */
c-[vg] { color: #0077aa } /* Name.Variable.Global */
c-[vi] { color: #0077aa } /* Name.Variable.Instance */
c-[il] { color: #000000 } /* Literal.Number.Integer.Long */
</style>
<style>/* style-var-click-highlighting */
var { cursor: pointer; }
var.selected0 { background-color: #F4D200; box-shadow: 0 0 0 2px #F4D200; }
var.selected1 { background-color: #FF87A2; box-shadow: 0 0 0 2px #FF87A2; }
var.selected2 { background-color: #96E885; box-shadow: 0 0 0 2px #96E885; }
var.selected3 { background-color: #3EEED2; box-shadow: 0 0 0 2px #3EEED2; }
var.selected4 { background-color: #EACFB6; box-shadow: 0 0 0 2px #EACFB6; }
var.selected5 { background-color: #82DDFF; box-shadow: 0 0 0 2px #82DDFF; }
var.selected6 { background-color: #FFBCF2; box-shadow: 0 0 0 2px #FFBCF2; }
</style>
<style>/* style-darkmode */
@media (prefers-color-scheme: dark) {
:root {
--text: #ddd;
--bg: black;
--unofficial-watermark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cg fill='%23100808' transform='translate(200 200) rotate(-45) translate(-200 -200)' stroke='%23100808' stroke-width='3'%3E%3Ctext x='50%25' y='220' style='font: bold 70px sans-serif; text-anchor: middle; letter-spacing: 6px;'%3EUNOFFICIAL%3C/text%3E%3Ctext x='50%25' y='305' style='font: bold 70px sans-serif; text-anchor: middle; letter-spacing: 6px;'%3EDRAFT%3C/text%3E%3C/g%3E%3C/svg%3E");
--logo-bg: #1a5e9a;
--logo-active-bg: #c00;
--logo-text: white;
--tocnav-normal-text: #999;
--tocnav-normal-bg: var(--bg);
--tocnav-hover-text: var(--tocnav-normal-text);
--tocnav-hover-bg: #080808;
--tocnav-active-text: #f44;
--tocnav-active-bg: var(--tocnav-normal-bg);
--tocsidebar-text: var(--text);
--tocsidebar-bg: #080808;
--tocsidebar-shadow: rgba(255,255,255,.1);
--tocsidebar-heading-text: hsla(203,20%,40%,.7);
--toclink-text: var(--text);
--toclink-underline: #6af;
--toclink-visited-text: var(--toclink-text);
--toclink-visited-underline: #054572;
--heading-text: #8af;
--hr-text: var(--text);
--algo-border: #456;
--del-text: #f44;
--del-bg: transparent;
--ins-text: #4a4;
--ins-bg: transparent;
--a-normal-text: #6af;
--a-normal-underline: #555;
--a-visited-text: var(--a-normal-text);
--a-visited-underline: var(--a-normal-underline);
--a-hover-bg: rgba(25%, 25%, 25%, .2);
--a-active-text: #f44;
--a-active-underline: var(--a-active-text);
--borderedblock-bg: rgba(255, 255, 255, .05);
--blockquote-border: silver;
--blockquote-bg: var(--borderedblock-bg);
--blockquote-text: currentcolor;
--issue-border: #e05252;
--issue-bg: var(--borderedblock-bg);
--issue-text: var(--text);
--issueheading-text: hsl(0deg, 70%, 70%);
--example-border: hsl(50deg, 90%, 60%);
--example-bg: var(--borderedblock-bg);
--example-text: var(--text);
--exampleheading-text: hsl(50deg, 70%, 70%);
--note-border: hsl(120deg, 100%, 35%);
--note-bg: var(--borderedblock-bg);
--note-text: var(--text);
--noteheading-text: hsl(120, 70%, 70%);
--notesummary-underline: silver;
--assertion-border: #444;
--assertion-bg: var(--borderedblock-bg);
--assertion-text: var(--text);
--advisement-border: orange;
--advisement-bg: #222218;
--advisement-text: var(--text);
--advisementheading-text: #f84;
--warning-border: red;
--warning-bg: hsla(40,100%,20%,0.95);
--warning-text: var(--text);
--amendment-border: #330099;
--amendment-bg: #080010;
--amendment-text: var(--text);
--amendmentheading-text: #cc00ff;
--def-border: #8ccbf2;
--def-bg: #080818;
--def-text: var(--text);
--defrow-border: #136;
--datacell-border: silver;
--indexinfo-text: #aaa;
--indextable-hover-text: var(--text);
--indextable-hover-bg: #181818;
--outdatedspec-bg: rgba(255, 255, 255, .5);
--outdatedspec-text: black;
--outdated-bg: maroon;
--outdated-text: white;
--outdated-shadow: red;
--editedrec-bg: darkorange;
}
/* In case a transparent-bg image doesn't expect to be on a dark bg,
which is quite common in practice... */
img { background: white; }
}
@media (prefers-color-scheme: dark) {
:root {
--selflink-text: black;
--selflink-bg: silver;
--selflink-hover-text: white;
}
}
@media (prefers-color-scheme: dark) {
:root {
--dfnpanel-bg: #222;
--dfnpanel-text: var(--text);
}
}
@media (prefers-color-scheme: dark) {
.highlight:not(.idl) { background: rgba(255, 255, 255, .05); }
c-[a] { color: #d33682 } /* Keyword.Declaration */
c-[b] { color: #d33682 } /* Keyword.Type */
c-[c] { color: #2aa198 } /* Comment */
c-[d] { color: #2aa198 } /* Comment.Multiline */
c-[e] { color: #268bd2 } /* Name.Attribute */
c-[f] { color: #b58900 } /* Name.Tag */
c-[g] { color: #cb4b16 } /* Name.Variable */
c-[k] { color: #d33682 } /* Keyword */
c-[l] { color: #657b83 } /* Literal */
c-[m] { color: #657b83 } /* Literal.Number */
c-[n] { color: #268bd2 } /* Name */
c-[o] { color: #657b83 } /* Operator */
c-[p] { color: #657b83 } /* Punctuation */
c-[s] { color: #6c71c4 } /* Literal.String */
c-[t] { color: #6c71c4 } /* Literal.String.Single */
c-[u] { color: #6c71c4 } /* Literal.String.Double */
c-[ch] { color: #2aa198 } /* Comment.Hashbang */
c-[cp] { color: #2aa198 } /* Comment.Preproc */
c-[cpf] { color: #2aa198 } /* Comment.PreprocFile */
c-[c1] { color: #2aa198 } /* Comment.Single */
c-[cs] { color: #2aa198 } /* Comment.Special */
c-[kc] { color: #d33682 } /* Keyword.Constant */
c-[kn] { color: #d33682 } /* Keyword.Namespace */
c-[kp] { color: #d33682 } /* Keyword.Pseudo */
c-[kr] { color: #d33682 } /* Keyword.Reserved */
c-[ld] { color: #657b83 } /* Literal.Date */
c-[nc] { color: #268bd2 } /* Name.Class */
c-[no] { color: #268bd2 } /* Name.Constant */
c-[nd] { color: #268bd2 } /* Name.Decorator */
c-[ni] { color: #268bd2 } /* Name.Entity */
c-[ne] { color: #268bd2 } /* Name.Exception */
c-[nf] { color: #268bd2 } /* Name.Function */
c-[nl] { color: #268bd2 } /* Name.Label */
c-[nn] { color: #268bd2 } /* Name.Namespace */
c-[py] { color: #268bd2 } /* Name.Property */
c-[ow] { color: #657b83 } /* Operator.Word */
c-[mb] { color: #657b83 } /* Literal.Number.Bin */
c-[mf] { color: #657b83 } /* Literal.Number.Float */
c-[mh] { color: #657b83 } /* Literal.Number.Hex */
c-[mi] { color: #657b83 } /* Literal.Number.Integer */
c-[mo] { color: #657b83 } /* Literal.Number.Oct */
c-[sa] { color: #6c71c4 } /* Literal.String.Affix */
c-[sb] { color: #6c71c4 } /* Literal.String.Backtick */
c-[sc] { color: #6c71c4 } /* Literal.String.Char */
c-[dl] { color: #6c71c4 } /* Literal.String.Delimiter */
c-[sd] { color: #6c71c4 } /* Literal.String.Doc */
c-[se] { color: #6c71c4 } /* Literal.String.Escape */
c-[sh] { color: #6c71c4 } /* Literal.String.Heredoc */
c-[si] { color: #6c71c4 } /* Literal.String.Interpol */
c-[sx] { color: #6c71c4 } /* Literal.String.Other */
c-[sr] { color: #6c71c4 } /* Literal.String.Regex */
c-[ss] { color: #6c71c4 } /* Literal.String.Symbol */
c-[fm] { color: #268bd2 } /* Name.Function.Magic */
c-[vc] { color: #cb4b16 } /* Name.Variable.Class */
c-[vg] { color: #cb4b16 } /* Name.Variable.Global */
c-[vi] { color: #cb4b16 } /* Name.Variable.Instance */
c-[vm] { color: #cb4b16 } /* Name.Variable.Magic */
c-[il] { color: #657b83 } /* Literal.Number.Integer.Long */
}
</style>
<body class="h-entry">
<div class="head">
<p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a> </p>
<h1>Keyboard Map</h1>
<p id="w3c-state"><a href="https://www.w3.org/standards/types#CG-DRAFT">Draft Community Group Report</a>, <time class="dt-updated" datetime="2022-06-17">17 June 2022</time></p>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
<dd><a class="u-url" href="https://wicg.github.io/keyboard-map/">https://wicg.github.io/keyboard-map/</a>
<dt>Issue Tracking:
<dd><a href="https://github.com/wicg/keyboard-map/issues/">GitHub</a>
<dt class="editor">Editors:
<dd class="editor p-author h-card vcard"><span class="p-name fn"></span>
<dd class="editor p-author h-card vcard"><a class="p-name fn u-email email" href="mailto:[email protected]">Gary Kacmarcik</a> (<span class="p-org org">Google</span>)
<dt>Explainer:
<dd><a href="https://github.com/wicg/keyboard-map/blob/master/explainer.md">Keyboard Map Explainer</a>
</dl>
</div>
<div data-fill-with="warning"></div>
<p class="copyright" data-fill-with="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2022 the Contributors to the Keyboard Map Specification, published by the <a href="https://www.w3.org/community/wicg/">Web Platform Incubator Community Group</a> under the <a href="https://www.w3.org/community/about/agreements/cla/">W3C Community Contributor License Agreement (CLA)</a>.
A human-readable <a href="http://www.w3.org/community/about/agreements/cla-deed/">summary</a> is available. </p>
<hr title="Separator for header">
</div>
<div class="p-summary" data-fill-with="abstract">
<h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
<p>This specification defines an API that allows websites to convert from a given <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/uievents/#dom-keyboardevent-code" id="ref-for-dom-keyboardevent-code">code</a></code> value to a
valid <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/uievents/#dom-keyboardevent-key" id="ref-for-dom-keyboardevent-key">key</a></code> value that can be shown to the user to
identify the given key.
The conversion from <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/uievents/#dom-keyboardevent-code" id="ref-for-dom-keyboardevent-code①">code</a></code> to <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/uievents/#dom-keyboardevent-key" id="ref-for-dom-keyboardevent-key①">key</a></code> is based on
the user’s currently selected keyboard layout.
It is intended to be used by web applications that want to treat the keyboard as a
set of buttons and need to describe those buttons to the user.</p>
</div>
<div data-fill-with="at-risk"></div>
<h2 class="no-num no-toc no-ref heading settled" id="status"><span class="content">Status of this document</span></h2>
<div data-fill-with="status">
<p> This specification was published by the <a href="https://www.w3.org/community/wicg/">Web Platform Incubator Community Group</a>.
It is not a W3C Standard nor is it on the W3C Standards Track.
Please note that under the <a href="https://www.w3.org/community/about/agreements/cla/">W3C Community Contributor License Agreement (CLA)</a> there is a limited opt-out and other conditions apply.
Learn more about <a href="http://www.w3.org/community/">W3C Community and Business Groups</a>. </p>
<p></p>
<p>This document is an editor’s draft proposed as a First Public Working Draft.</p>
</div>
<div data-fill-with="at-risk"></div>
<nav data-fill-with="table-of-contents" id="toc">
<h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
<ol class="toc" role="directory">
<li><a href="#introduction"><span class="secno">1</span> <span class="content">Introduction</span></a>
<li>
<a href="#API"><span class="secno">2</span> <span class="content">Keyboard Map API</span></a>
<ol class="toc">
<li><a href="#navigator-interface"><span class="secno">2.1</span> <span class="content">Navigator Interface</span></a>
<li><a href="#keyboardlayoutmap-interface"><span class="secno">2.2</span> <span class="content">KeyboardLayoutMap Interface</span></a>
<li>
<a href="#keyboard-interface"><span class="secno">2.3</span> <span class="content">Keyboard Interface</span></a>
<ol class="toc">
<li><a href="#h-keyboard-getlayoutmap"><span class="secno">2.3.1</span> <span class="content"><span>getLayoutMap()</span></span></a>
</ol>
<li><a href="#dead-and-combining"><span class="secno">2.4</span> <span class="content">Dead Keys and Combining Characters</span></a>
<li><a href="#ascii-capable-layouts"><span class="secno">2.5</span> <span class="content">ASCII-Capable Keyboard Layouts</span></a>
</ol>
<li>
<a href="#keyboard-events"><span class="secno">3</span> <span class="content">Keyboard Events</span></a>
<ol class="toc">
<li>
<a href="#layoutchange-event"><span class="secno">3.1</span> <span class="content">The <span>layoutchange</span> Event</span></a>
<ol class="toc">
<li><a href="#h-fire-a-layoutchange-event"><span class="secno">3.1.1</span> <span class="content"><span>fire a layoutchange event</span></span></a>
</ol>
</ol>
<li>
<a href="#integrations"><span class="secno">4</span> <span class="content">Integrations</span></a>
<ol class="toc">
<li><a href="#permissions-policy"><span class="secno">4.1</span> <span class="content">Permissions Policy</span></a>
</ol>
<li><a href="#mobile"><span class="secno">5</span> <span class="content">Mobile Device Considerations</span></a>
<li><a href="#security"><span class="secno">6</span> <span class="content">Security Considerations</span></a>
<li>
<a href="#privacy"><span class="secno">7</span> <span class="content">Privacy Considerations</span></a>
<ol class="toc">
<li><a href="#privacy-mitigations"><span class="secno">7.1</span> <span class="content">Privacy Mitigations</span></a>
<li><a href="#incognito"><span class="secno">7.2</span> <span class="content">Privacy Mode</span></a>
</ol>
<li><a href="#acknowledgements-contributors"><span class="secno">8</span> <span class="content">Acknowledgements</span></a>
<li><a href="#glossary"><span class="secno">9</span> <span class="content">Glossary</span></a>
<li>
<a href="#w3c-conformance"><span class="secno"></span> <span class="content">Conformance</span></a>
<ol class="toc">
<li><a href="#w3c-conventions"><span class="secno"></span> <span class="content">Document conventions</span></a>
<li><a href="#w3c-conformant-algorithms"><span class="secno"></span> <span class="content">Conformant Algorithms</span></a>
</ol>
<li>
<a href="#index"><span class="secno"></span> <span class="content">Index</span></a>
<ol class="toc">
<li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a>
<li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a>
</ol>
<li>
<a href="#references"><span class="secno"></span> <span class="content">References</span></a>
<ol class="toc">
<li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a>
</ol>
<li><a href="#idl-index"><span class="secno"></span> <span class="content">IDL Index</span></a>
</ol>
</nav>
<main>
<h2 class="heading settled" data-level="1" id="introduction"><span class="secno">1. </span><span class="content">Introduction</span><a class="self-link" href="#introduction"></a></h2>
<p>On a <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/uievents/#keyboardevent" id="ref-for-keyboardevent">KeyboardEvent</a></code>, the <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/uievents/#dom-keyboardevent-code" id="ref-for-dom-keyboardevent-code②">code</a></code> attribute encodes
a value that represents the physical location of the key that was pressed. This value
ignores the current locale (e.g., "en-US"), layout (e.g., "dvorak") and modifier state
(e.g., "Shift + Control"), so it is ideally suited for applications (like games) that
want to use the keyboard as a set of generic buttons. The idea behind the <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/uievents/#dom-keyboardevent-code" id="ref-for-dom-keyboardevent-code③">code</a></code> attribute is that it provides a platform-neutral <a data-link-type="dfn" href="#scancode" id="ref-for-scancode">scancode</a> for each physical key.</p>
<p>The <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/uievents/#dom-keyboardevent-key" id="ref-for-dom-keyboardevent-key②">key</a></code> attribute, on the other hand, contains the value that is
generated by the key press, accounting for the locale, layout, and modifier
keys. Almost every Unicode character is a valid `key` attribute, along with a number
of special named values (see <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/uievents/#keyboardevent" id="ref-for-keyboardevent①">KeyboardEvent</a></code> <a data-link-type="dfn" href="http://www.w3.org/TR/uievents-key/#key-attribute-value" id="ref-for-key-attribute-value">key attribute values</a>),
so there are thousands of possible <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/uievents/#dom-keyboardevent-key" id="ref-for-dom-keyboardevent-key③">key</a></code> values.</p>
<p>Because most users have a physical keyboard that matches their locale and layout,
we can reasonably assume that the <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/uievents/#dom-keyboardevent-key" id="ref-for-dom-keyboardevent-key④">key</a></code> value is a good stand-in for
the glyph printed on the keycap. While this does not hold true when the user has
selected a different layout, in that case the user is well-aware of the mismatch
between the glyph on the keycap and the character generated by a key press.</p>
<p>The API described in this document provides a simple way of obtaining this basic <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/uievents/#dom-keyboardevent-code" id="ref-for-dom-keyboardevent-code④">code</a></code> to <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/uievents/#dom-keyboardevent-key" id="ref-for-dom-keyboardevent-key⑤">key</a></code> mapping.</p>
<h2 class="heading settled" data-level="2" id="API"><span class="secno">2. </span><span class="content">Keyboard Map API</span><a class="self-link" href="#API"></a></h2>
<p>The Keyboard Map API extends the <code class="idl"><a data-link-type="idl" href="https://wicg.github.io/keyboard-lock/#keyboard" id="ref-for-keyboard">Keyboard</a></code> interface to add attributes and
methods related to the current keyboard layout.</p>
<h3 class="heading settled" data-level="2.1" id="navigator-interface"><span class="secno">2.1. </span><span class="content">Navigator Interface</span><a class="self-link" href="#navigator-interface"></a></h3>
<p>The <code class="idl"><a data-link-type="idl" href="https://wicg.github.io/keyboard-lock/#dom-navigator-keyboard" id="ref-for-dom-navigator-keyboard">keyboard</a></code> attribute on the <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/system-state.html#navigator" id="ref-for-navigator">Navigator</a></code> object is specified in <a href="https://wicg.github.io/keyboard-lock/#navigator-interface">Keyboard-Lock</a>.</p>
<h3 class="heading settled" data-level="2.2" id="keyboardlayoutmap-interface"><span class="secno">2.2. </span><span class="content">KeyboardLayoutMap Interface</span><a class="self-link" href="#keyboardlayoutmap-interface"></a></h3>
<div class="mdn-anno wrapped after">
<button class="mdn-anno-btn"><b class="less-than-two-engines-flag" title="This feature is in less than two current engines.">⚠</b><span>MDN</span></button>
<div class="feature">
<p><a href="https://developer.mozilla.org/en-US/docs/Web/API/KeyboardLayoutMap" title="The KeyboardLayoutMap interface of the Keyboard API is a map-like object with functions for retrieving the string associated with specific physical keys.">KeyboardLayoutMap</a></p>
<p class="less-than-two-engines-text">In only one current engine.</p>
<div class="support">
<span class="firefox no"><span>Firefox</span><span>None</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>69+</span></span>
<hr>
<span class="opera yes"><span>Opera</span><span>55+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span>
<hr>
<span class="edge no"><span>Edge (Legacy)</span><span>None</span></span><span class="ie no"><span>IE</span><span>None</span></span>
<hr>
<span class="firefox_android no"><span>Firefox for Android</span><span>None</span></span><span class="safari_ios no"><span>iOS Safari</span><span>None</span></span><span class="chrome_android yes"><span>Chrome for Android</span><span>69+</span></span><span class="webview_android yes"><span>Android WebView</span><span>69+</span></span><span class="samsunginternet_android yes"><span>Samsung Internet</span><span>10.0+</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>48+</span></span>
</div>
</div>
</div>
<pre class="idl highlight def" data-highlight="webidl">[<a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed" id="ref-for-Exposed"><c- g>Exposed</c-></a>=<c- n>Window</c->]
<c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="keyboardlayoutmap"><code><c- g>KeyboardLayoutMap</c-></code></dfn> {
<c- b>readonly</c-> <c- b>maplike</c-><<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString" id="ref-for-idl-DOMString"><c- b>DOMString</c-></a>, <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString" id="ref-for-idl-DOMString①"><c- b>DOMString</c-></a>>;
};
</pre>
<div id="keyboardlayoutmap-idl">
<p>The <code class="idl"><a data-link-type="idl" href="#keyboardlayoutmap" id="ref-for-keyboardlayoutmap">KeyboardLayoutMap</a></code> is a readonly collection of mappings from <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/uievents/#dom-keyboardevent-code" id="ref-for-dom-keyboardevent-code⑤">code</a></code> values to <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/uievents/#dom-keyboardevent-key" id="ref-for-dom-keyboardevent-key⑥">key</a></code> values.</p>
</div>
<h3 class="heading settled" data-level="2.3" id="keyboard-interface"><span class="secno">2.3. </span><span class="content">Keyboard Interface</span><a class="self-link" href="#keyboard-interface"></a></h3>
<div class="mdn-anno wrapped after">
<button class="mdn-anno-btn"><b class="less-than-two-engines-flag" title="This feature is in less than two current engines.">⚠</b><span>MDN</span></button>
<div class="feature">
<p><a href="https://developer.mozilla.org/en-US/docs/Web/API/Keyboard" title="The Keyboard interface of the Keyboard API provides functions that retrieve keyboard layout maps and toggle capturing of key presses from the physical keyboard.">Keyboard</a></p>
<p class="less-than-two-engines-text">In only one current engine.</p>
<div class="support">
<span class="firefox no"><span>Firefox</span><span>None</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>68+</span></span>
<hr>
<span class="opera yes"><span>Opera</span><span>55+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span>
<hr>
<span class="edge no"><span>Edge (Legacy)</span><span>None</span></span><span class="ie no"><span>IE</span><span>None</span></span>
<hr>
<span class="firefox_android no"><span>Firefox for Android</span><span>None</span></span><span class="safari_ios no"><span>iOS Safari</span><span>None</span></span><span class="chrome_android yes"><span>Chrome for Android</span><span>68+</span></span><span class="webview_android yes"><span>Android WebView</span><span>68+</span></span><span class="samsunginternet_android yes"><span>Samsung Internet</span><span>10.0+</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>48+</span></span>
</div>
</div>
</div>
<pre class="idl highlight def" data-highlight="webidl"><c- b>partial</c-> <c- b>interface</c-> <a class="idl-code" data-link-type="interface" href="https://wicg.github.io/keyboard-lock/#keyboard" id="ref-for-keyboard①"><c- g>Keyboard</c-></a> {
<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise"><c- b>Promise</c-></a><<a data-link-type="idl-name" href="#keyboardlayoutmap" id="ref-for-keyboardlayoutmap①"><c- n>KeyboardLayoutMap</c-></a>> <dfn class="idl-code" data-dfn-for="Keyboard" data-dfn-type="method" data-export data-lt="getLayoutMap()" id="dom-keyboard-getlayoutmap"><code><c- g>getLayoutMap</c-></code><a class="self-link" href="#dom-keyboard-getlayoutmap"></a></dfn>();
<c- b>attribute</c-> <a data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler" id="ref-for-eventhandler"><c- n>EventHandler</c-></a> <dfn class="idl-code" data-dfn-for="Keyboard" data-dfn-type="attribute" data-export data-type="EventHandler" id="dom-keyboard-onlayoutchange"><code><c- g>onlayoutchange</c-></code><a class="self-link" href="#dom-keyboard-onlayoutchange"></a></dfn>;
};
</pre>
<p class="note" role="note"><span>Note:</span> The base <code class="idl"><a data-link-type="idl" href="https://wicg.github.io/keyboard-lock/#keyboard" id="ref-for-keyboard②">Keyboard</a></code> interface is specified in <a data-link-type="biblio" href="#biblio-keyboard-lock">[Keyboard-Lock]</a>.</p>
<div id="keyboard-idl">
<div class="algorithm" data-algorithm="keyboard-getlayoutmap">
<h4 class="heading settled" data-level="2.3.1" id="h-keyboard-getlayoutmap"><span class="secno">2.3.1. </span><span class="content"><dfn class="dfn-paneled" data-dfn-for="Keyboard" data-dfn-type="dfn" data-noexport id="keyboard-getlayoutmap">getLayoutMap()</dfn></span><a class="self-link" href="#h-keyboard-getlayoutmap"></a></h4>
<div class="mdn-anno wrapped after">
<button class="mdn-anno-btn"><b class="less-than-two-engines-flag" title="This feature is in less than two current engines.">⚠</b><span>MDN</span></button>
<div class="feature">
<p><a href="https://developer.mozilla.org/en-US/docs/Web/API/Keyboard/getLayoutMap" title="The getLayoutMap() method of the Keyboard interface returns a Promise that resolves with an instance of KeyboardLayoutMap which is a map-like object with functions for retrieving the strings associated with specific physical keys.">Keyboard/getLayoutMap</a></p>
<p class="less-than-two-engines-text">In only one current engine.</p>
<div class="support">
<span class="firefox no"><span>Firefox</span><span>None</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>69+</span></span>
<hr>
<span class="opera yes"><span>Opera</span><span>56+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span>
<hr>
<span class="edge no"><span>Edge (Legacy)</span><span>None</span></span><span class="ie no"><span>IE</span><span>None</span></span>
<hr>
<span class="firefox_android no"><span>Firefox for Android</span><span>None</span></span><span class="safari_ios no"><span>iOS Safari</span><span>None</span></span><span class="chrome_android yes"><span>Chrome for Android</span><span>69+</span></span><span class="webview_android yes"><span>Android WebView</span><span>69+</span></span><span class="samsunginternet_android yes"><span>Samsung Internet</span><span>10.0+</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>48+</span></span>
</div>
</div>
</div>
<p>When <a data-link-type="dfn" href="#keyboard-getlayoutmap" id="ref-for-keyboard-getlayoutmap">getLayoutMap()</a> is called, the user agent must
run the following steps:</p>
<ol>
<li data-md>
<p>Let <var>p</var> be a new <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise①">Promise</a></code>.</p>
<li data-md>
<p>If <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this">this</a>'s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global" id="ref-for-concept-relevant-global">relevant global object</a>'s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/window-object.html#concept-document-window" id="ref-for-concept-document-window">associated Document</a> is not <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/iframe-embed-object.html#allowed-to-use" id="ref-for-allowed-to-use">allowed to use</a> the <a data-link-type="dfn" href="https://w3c.github.io/webappsec-permissions-policy/#policy-controlled-feature" id="ref-for-policy-controlled-feature">policy-controlled feature</a> named "keyboard-map"</p>
<ol>
<li data-md>
<p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#reject" id="ref-for-reject">Reject</a> <var>p</var> with a "<code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#securityerror" id="ref-for-securityerror">SecurityError</a></code>" <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-DOMException" id="ref-for-idl-DOMException">DOMException</a></code>.</p>
<li data-md>
<p>Return <var>p</var></p>
</ol>
<li data-md>
<p>Run the following steps <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel" id="ref-for-in-parallel">in parallel</a>:</p>
<ol>
<li data-md>
<p>Let <var>map</var> be a new <code class="idl"><a data-link-type="idl" href="#keyboardlayoutmap" id="ref-for-keyboardlayoutmap②">KeyboardLayoutMap</a></code> that is initially empty.</p>
<li data-md>
<p>For each value <var>code</var> in the "KeyboardEvent code" column of the <a data-link-type="dfn" href="http://www.w3.org/TR/uievents-code/#writing-system-keys" id="ref-for-writing-system-keys">Writing System Keys</a> table</p>
<ol>
<li data-md>
<p>Let <var>layout</var> be the highest priority <a data-link-type="dfn" href="#ascii-capable" id="ref-for-ascii-capable">ASCII-capable</a> keyboard layout,
or the highest priority keyboard layout if none of the available
layouts are <a data-link-type="dfn" href="#ascii-capable" id="ref-for-ascii-capable①">ASCII-capable</a>.</p>
<li data-md>
<p>If <var>code</var> is not a valid key in the <var>layout</var>, then continue</p>
<li data-md>
<p>Let <var>key</var> be the <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/uievents/#dom-keyboardevent-key" id="ref-for-dom-keyboardevent-key⑦">key</a></code> value that would be generated
by <var>layout</var> if the key identified by <var>code</var> was pressed with no modifiers.</p>
<li data-md>
<p>If <var>key</var> is a <a data-link-type="dfn" href="http://www.w3.org/TR/uievents/#dead-key" id="ref-for-dead-key">dead key</a>, then</p>
<ol>
<li data-md>
<p>Set <var>key</var> to the standalone character that corresponds
to the <a data-link-type="dfn" href="http://www.w3.org/TR/uievents/#dead-key" id="ref-for-dead-key①">dead key</a>, as defined in the <a href="#table1">Standalone Equivalents for Dead Keys</a> table.</p>
</ol>
<li data-md>
<p>Create a map entry <var>e</var> from the pair < <var>code</var>, <var>key</var> ></p>
<li data-md>
<p>Add <var>e</var> to <var>map</var>.</p>
</ol>
<li data-md>
<p>Resolve <var>p</var> with <var>map</var>.</p>
</ol>
<li data-md>
<p>Return <var>p</var>.</p>
</ol>
<div></div>
<p>User agents may choose to cache the <var>map</var> and return the cached value as
long as the cache is updated (or invalidated) whenever the keyboard layout
changes.</p>
<div class="example" id="example-8462fa78">
<a class="self-link" href="#example-8462fa78"></a> To show instructions about which key to press in a game:
<pre>navigator.keyboard.getLayoutMap().then(function(map) {
var keyUp = map.get("KeyW");
showUserDialog("Press " + keyUp + " to move up.");
});
</pre>
</div>
<div class="example" id="example-44ae8418"><a class="self-link" href="#example-44ae8418"></a> On a "US International" keyboard where the single-quote (') key is a <a data-link-type="dfn" href="http://www.w3.org/TR/uievents/#dead-key" id="ref-for-dead-key②">dead key</a> that adds an acute accent to the following character.
The keyboard map would contain an entry mapping <a data-link-type="dfn" href="http://www.w3.org/TR/uievents-code/#code-quote" id="ref-for-code-quote">Quote</a> (the <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/uievents/#dom-keyboardevent-code" id="ref-for-dom-keyboardevent-code⑥">code</a></code> for this key) to "'" (the single-quote character U+0027). </div>
</div>
</div>
<h3 class="heading settled" data-level="2.4" id="dead-and-combining"><span class="secno">2.4. </span><span class="content">Dead Keys and Combining Characters</span><a class="self-link" href="#dead-and-combining"></a></h3>
<p>Since the intent of the keyboard map API is to provide human-readable
descriptions for keys on the user’s keyboard, <a data-link-type="dfn" href="http://www.w3.org/TR/uievents/#dead-key" id="ref-for-dead-key③">dead keys</a> or
combining characters need to be converted into standalone forms so that
they can be used directly.</p>
<p>The following table defines how to map from common <a data-link-type="dfn" href="http://www.w3.org/TR/uievents/#dead-key" id="ref-for-dead-key④">dead keys</a> and
combining characters into standalone characters.</p>
<table>
<caption id="table1">Table 1: Standalone Equivalents for Dead Keys</caption>
<thead>
<tr>
<th>Dead Key<br>Name
<th>Unicode<br>Combining
<th>Standalone<br>Character
<th>Unicode<br>Standalone
<tbody>
<tr>
<td>Grave
<td>U+0300
<td>"`"
<td>U+0060
<tr>
<td>Acute
<td>U+0301
<td>"'"
<td>U+0027
<tr>
<td>Circumflex
<td>U+0302
<td>"^"
<td>U+005e
<tr>
<td>Tilde
<td>U+0303
<td>"~"
<td>U+007e
<tr>
<td>Diaeresis
<td>U+0308
<td>"¨"
<td>U+00a8
</table>
<h3 class="heading settled" data-level="2.5" id="ascii-capable-layouts"><span class="secno">2.5. </span><span class="content">ASCII-Capable Keyboard Layouts</span><a class="self-link" href="#ascii-capable-layouts"></a></h3>
<p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="ascii-capable">ASCII-capable</dfn> keyboard layout is one that:</p>
<ul>
<li data-md>
<p>Is capable of producing all of the basic ASCII characters "A" - "Z" without
requiring the use of any modifier keys.</p>
<li data-md>
<p>Produces a valid, printable character for all the <a data-link-type="dfn" href="#common-writing-system-keys" id="ref-for-common-writing-system-keys">common writing system keys</a>.</p>
</ul>
<p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="common-writing-system-keys">common writing system keys</dfn> are those that are common to all
keyboard layouts, as shown in blue in <a href="https://www.w3.org/TR/uievents-code/#figure-keyboard-codes-alphanum1">Figure 13</a> of the <a data-link-type="biblio" href="#biblio-uievents-code">[UIEvents-Code]</a> specification.</p>
<h2 class="heading settled" data-level="3" id="keyboard-events"><span class="secno">3. </span><span class="content">Keyboard Events</span><a class="self-link" href="#keyboard-events"></a></h2>
<h3 class="heading settled" data-level="3.1" id="layoutchange-event"><span class="secno">3.1. </span><span class="content">The <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="layoutchange">layoutchange</dfn> Event</span><a class="self-link" href="#layoutchange-event"></a></h3>
<p>When the user agent detects that the current keyboard layout has changed, then
it MUST <a data-link-type="dfn" href="#fire-a-layoutchange-event" id="ref-for-fire-a-layoutchange-event">fire a layoutchange event</a>. The exact timing of a layout change depends
on the underlying platform but it is commonly triggered either directly by a user
action (for example, when the user selects a new layout), or indirectly
(such as when switching to an application that has a preferred layout).</p>
<p>Note the following:</p>
<ul>
<li data-md>
<p>Modifying the set of available layouts should not trigger a <a data-link-type="dfn" href="#layoutchange" id="ref-for-layoutchange">layoutchange</a> event, unless the modification changes the current layout.</p>
<li data-md>
<p>Adding or removing a physical keyboard should not trigger an event unless
the system has functionality to change the current layout based on adding or
removing a physical keyboard. But note that it is the layout change that
triggers this event, not the act of adding or removing the physical keyboard.</p>
<li data-md>
<p>The event must be fired whenever the current layout changes, even if the
highest priority ASCII-capable layout remains the same.</p>
</ul>
<p>If the keyboard layout changes while the user agent is not the foreground
application, then the user agent MUST <a data-link-type="dfn" href="#fire-a-layoutchange-event" id="ref-for-fire-a-layoutchange-event①">fire a layoutchange event</a> when it
regains focus.</p>
<div class="example" id="example-659c10ea">
<a class="self-link" href="#example-659c10ea"></a> To handle this event:
<pre>navigator.keyboard.addEventListener("layoutchange", function() {
// Update user keyboard map settings
updateGameControlSettingsPage();
});
</pre>
</div>
<div class="algorithm" data-algorithm="fire-a-layoutchange-event">
<h4 class="heading settled" data-level="3.1.1" id="h-fire-a-layoutchange-event"><span class="secno">3.1.1. </span><span class="content"><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="fire-a-layoutchange-event">fire a layoutchange event</dfn></span><a class="self-link" href="#h-fire-a-layoutchange-event"></a></h4>
<p>To fire a "layoutchange" event, <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire" id="ref-for-concept-event-fire">fire an event</a> named <dfn class="idl-code" data-dfn-for="Keyboard" data-dfn-type="event" data-export id="eventdef-keyboard-layoutchange"><code>layoutchange</code><a class="self-link" href="#eventdef-keyboard-layoutchange"></a></dfn> at the <code class="idl"><a data-link-type="idl" href="https://wicg.github.io/keyboard-lock/#dom-navigator-keyboard" id="ref-for-dom-navigator-keyboard①">keyboard</a></code> attribute on the user agent’s <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/system-state.html#navigator" id="ref-for-navigator①">Navigator</a></code> object.</p>
</div>
<h2 class="heading settled" data-level="4" id="integrations"><span class="secno">4. </span><span class="content">Integrations</span><a class="self-link" href="#integrations"></a></h2>
<h3 class="heading settled" data-level="4.1" id="permissions-policy"><span class="secno">4.1. </span><span class="content">Permissions Policy</span><a class="self-link" href="#permissions-policy"></a></h3>
<p>This specification defines a feature that controls whether the <a data-link-type="dfn" href="#keyboard-getlayoutmap" id="ref-for-keyboard-getlayoutmap①">getLayoutMap()</a> method is exposed on the <code class="idl"><a data-link-type="idl" href="https://wicg.github.io/keyboard-lock/#keyboard" id="ref-for-keyboard③">Keyboard</a></code> interface.</p>
<p>The feature name for this feature is "keyboard-map".</p>
<p>The <a data-link-type="dfn" href="https://w3c.github.io/webappsec-permissions-policy/#default-allowlist" id="ref-for-default-allowlist">default allowlist</a> for this feature is "self".</p>
<h2 class="heading settled" data-level="5" id="mobile"><span class="secno">5. </span><span class="content">Mobile Device Considerations</span><a class="self-link" href="#mobile"></a></h2>
<p>Since this is a keyboard-focused API and mobile devices do not commonly
have physical keyboards, this API will not typically be present or
supported on mobile devices.</p>