-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy path2022.html
2125 lines (2088 loc) · 90.5 KB
/
2022.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>
<head>
<meta charset="utf-8" />
<title>Web Components Community Group: 2022 Spec/API status</title>
<script
src="https://www.w3.org/Tools/respec/respec-w3c"
class="remove"
defer
></script>
<script class="remove">
// All config options at https://respec.org/docs/
var respecConfig = {
specStatus: "CG-DRAFT",
latestVersion: null,
edDraftURI: null,
editors: [
{
name: "Westbrook Johnson",
url: "https://westbrookjohnson.com",
},
{
name: "Alan Dávalos",
url: "https://github.com/alangdm",
},
{
name: "Rob Eisenberg",
url: "https://github.com/eisenbergeffect",
},
{
name: "Owen Buckley",
url: "https://github.com/thescientist13",
},
{
name: "Caleb Williams",
url: "https://github.com/calebdwilliams"
},
{
name: "Justin Fagnani",
url: "https://github.com/justinfagnani"
}
],
github: "w3c/webcomponents-cg",
shortName: "webcomponents-cg",
xref: "web-platform",
group: "webcomponents",
tocIntroductory: true,
};
</script>
</head>
<body>
<section id="abstract">
<p>This is required.</p>
</section>
<section id="sotd">
<p>This is required.</p>
</section>
<section class="informative">
<h2>Introduction</h2>
<p>The initial slate of APIs that browsers shipped with web components "v1" left many important features and use-cases on a future to-do list, to be finalized out after the core custom element and shadow DOM features landed. While the web components GitHub issues and face-to-face meets have tracked and discussed many of these features individually, there hasn't been a comprehensive overview of what's left to "finish" web components.</p>
<p>This document tries to highlight the main features that are lacking from the web components spec that either block adoption for more developers and frameworks, or cause pain points for existing developers.</p>
<p>It's worth noting that many of these pain points are directly related to Shadow DOM's encapsulation. While there are many benefits to some types of widely shared components to strong encapsulation, the friction of strong encapsulation has prevented most developers from adopting Shadow DOM, to the point of there being alternate proposals for style scoping that don't use Shadow DOM. We urge browser vendors to recognize these barriers and work to make Shadow DOM more usable by more developers.</p>
<section>
<h3>Browser Parity</h3>
<p>We noticed the following specs already have a high degree of alignment from an implementation perspective, but support in browsers is still not equally distributed. Filling in these gaps would be a big win for users and developers alike for a more predictable web.</p>
<ul>
<li><a href="#form-associated-custom-elements">FACE (Form-Associated Custom Elements)</a></li>
<li><a href="#constructable-stylesheets-adoptedstylesheets">Constructable Style Sheets</a></li>
<li><a href="#css-module-scripts">CSS Modules</a></li>
<li><a href="#imperative-slot-assignment">Imperative slots</a></li>
</ul>
</section>
<section>
<h3>Spec Alignment</h3>
<p>The following specs we see as highly valuable to the developer community for being able to deliver great web experiences to users when using Web Components. As it pertains to topics like Aria and SSR, these specs just need a little more alignment across browser implementors so that consensus can be achieved.</p>
<ul>
<li><a href="#cross-root-aria">Cross-root Aria</a></li>
<li><a href="#scoped-element-registries">Scoped Registries</a></li>
<li><a href="#declarative-shadow-dom">Declarative Shadow DOM</a></li>
</ul>
</section>
<section>
<h3>Table of Contents</h3>
<table>
<thead>
<tr>
<th>Feature or Problem</th>
<th>GitHub Issue(s)</th>
<th>Status(?)</th>
</tr>
</thead>
<tbody>
<tr>
<th><a href="#children-changed-callback">Children changed callback</a></th>
<td><a href="https://github.com/WICG/webcomponents/issues/809">WICG/webcomponents#809</a></td>
<td>Uncertain</td>
</tr>
<tr>
<th><a href="#composed-selection">Composed Selection</a></th>
<td><a href="https://github.com/WICG/webcomponents/issues/79">WICG/webcomponents#79</a></td>
<td>Partial consensus, divergent partial implementations</td>
</tr>
<tr>
<th><a href="#constructable-stylesheets-adoptedstylesheets">Constructable Stylesheets & adoptedStyleSheets</a></th>
<td><a href="https://github.com/WICG/webcomponents/issues/169">WICG/webcomponents#468</a></td>
<td>Some implementation</td>
</tr>
<tr>
<th><a href="#cross-root-aria">Cross-root ARIA</a></th>
<td>
<a href="https://github.com/WICG/aom/issues/169">WICG/aom#169</a><br>
<a href="https://github.com/WICG/aom/issues/107">WICG/aom#107</a><br>
<a href="https://github.com/WICG/webcomponents/issues/917">WICG/webcomponents#917</a><br>
<a href="https://github.com/WICG/webcomponents/issues/916">WICG/webcomponents#916</a>
</td>
<td>Uncertain</td>
</tr>
<tr>
<th><a href="#css-module-scripts">CSS Module Scripts</a></th>
<td><a href="https://github.com/WICG/webcomponents/issues/759">WICG/webcomponents#759</a></td>
<td>Some implementation</td>
</tr>
<tr>
<th><a href="#css-properties-and-values-inside-shadow-root">CSS Properties and values inside shadow root</a></th>
<td></td>
<td></td>
</tr>
<tr>
<th><a href="#custom-attributes">Custom Attributes</a></th>
<td><a href="https://github.com/w3c/webcomponents-cg/discussions/31#discussioncomment-3163644">Web Components CG Discussion</a></td>
<td>Not addressed</td>
</tr>
<tr>
<th><a href="#custom-css-state">Custom CSS State</a></th>
<td></td>
<td></td>
</tr>
<tr>
<th><a href="#declarative-css-modules">Declarative CSS Modules</a></th>
<td><a href="https://github.com/WICG/webcomponents/issues/939">WICG/webcomponents#939</a></td>
<td>Not Addressed</td>
</tr>
<tr>
<th><a href="#declarative-custom-elements">Declarative custom elements</a></th>
<td><a href="https://github.com/WICG/webcomponents/blob/gh-pages/proposals/Declarative-Custom-Elements-Strawman.md">Strawperson</a></td>
<td>Not addressed</td>
</tr>
<tr>
<th><a href="#declarative-shadow-dom">Declarative Shadow DOM</a></th>
<td><a href="https://github.com/whatwg/dom/issues/831">whatwg/dom#831</a></td>
<td>Partial consensus, some implementation</td>
</tr>
<tr>
<th><a href="#dom-parts">DOM Parts</a></th>
<td><a href="https://github.com/WICG/webcomponents/blob/gh-pages/proposals/DOM-Parts.md">DOM Part API - First Step of Template Instantiation</a></td>
<td>Uncertain</td>
</tr>
<tr>
<th><a href="#form-associated-custom-elements">Form-Associated Custom Elements</a></th>
<td><a href="https://github.com/WICG/webcomponents/issues/187">WICG/webcomponents#187</a></td>
<td>Some implementation</td>
</tr>
<tr>
<th><a href="#html-modules">HTML modules</a></th>
<td><a href="https://github.com/WICG/webcomponents/issues/645">WICG/webcomponents#645</a></td>
<td>Partial consensus, no implementations</td>
</tr>
<tr>
<th><a href="#imperative-slot-assignment">Imperative Slot Assignment</a></th>
<td><a href="https://github.com/whatwg/html/issues/3534" target="_blank">whatwg/html#3534</a></td>
<td>Partial Implementation</td>
</tr>
<tr>
<th><a href="#lazy-custom-element-definitions">Lazy custom element definitions</a></th>
<td><a href="https://github.com/WICG/webcomponents/issues/782">WICG/webcomponents#782</a></td>
<td>Uncertain</td>
</tr>
<tr>
<th><a href="#open-styling-of-shadow-roots">Open styling of shadow roots</a></th>
<td><a href="https://github.com/WICG/webcomponents/issues/909">WICG/webcomponents#909</a></td>
<td>Not addressed</td>
</tr>
<tr>
<th><a href="#scoped-element-registries">Scoped Element Registries</a></th>
<td><a href="https://github.com/WICG/webcomponents/issues/716">WICG/webcomponents#716</a></td>
<td>Consensus</td>
</tr>
<tr>
<th><a href="#styling-children-of-slotted-content">Styling children of slotted content</a></th>
<td></td>
<td></td>
</tr>
<tr>
<th><a href="#theming">Theming</a></th>
<td><a href="https://github.com/WICG/webcomponents/issues/864">WICG/webcomponents#864</a></td>
<td>Uncertain</td>
</tr>
<tr>
<th>---</th>
<td>---</td>
<td>---</td>
</tr>
</tbody>
</table>
</section>
</section>
<section>
<h2>Children changed callback</h2>
<section>
<h3>Links</h3>
<dl>
<dt>Previous WCCG Report(s)</dt>
<dd><a href="https://w3c.github.io/webcomponents-cg/2021.html#children-changed-callback">2021</a></dd>
<dt>GitHub issues:</dt>
<dd>
<ul>
<li><a href="https://github.com/WICG/webcomponents/issues/809">2019 discussion - open</a></li>
<li><a href="https://github.com/WICG/webcomponents/issues/619">December 2016 discussion - closed</a></li>
<li><a href="https://github.com/WICG/webcomponents/issues/551">August 2016 discussion regarding parsing timing - closed</a></li>
<li><a href="https://github.com/WICG/webcomponents/issues/550">August 2016 discussion - closed</a></li>
</ul>
</dd>
<dt>Browser positions:</dt>
<dd>---</dd>
<dt>Polyfills/Libraries</dt>
<dd><a href="https://github.com/WebReflection/html-parsed-element"> For the parsing behavior</a></dd>
</dl>
</section>
<section>
<h3>Description</h3>
<p>Provide a callback that triggers whenever the parser finishes parsing children or when a new child is inserted or an old child is removed.</p>
</section>
<section>
<h3>Status</h3>
<ul>
<li>Uncertain - no concrete proposal or consensus on spec</li>
</ul>
</section>
<section>
<h3>Initial API Summary/Quick API Proposal</h3>
<p>No concrete API proposal exists so far but the discussions seem to refer to using the callback similar to the attributeChangedCallback.</p>
<p>A component using said callback would look like this:</p>
<pre class="javascript">
class ChildrenChangedCallbackSample extends HTMLElement {
childrenChangedCallback() {}
}
</pre>
</section>
<section>
<h3>Key Scenarios</h3>
<ul>
<li><strong>Children parsed</strong>: This proposal would act as a cross-browser method of detecting when a custom element's children have been fully parsed reliably.</li>
<li><strong>Children inserted/removed</strong>: This proposal would provide better ergonomics to react to insertion or removal of children nodes than using a MutationObserver.</li>
</ul>
</section>
<section>
<h3>Concerns</h3>
<ul>
<li>Too expensive to implement: this is no longer the case, all engines have mechanisms for this already</li>
<li>The addition of the parsing behavior might encourage assuming a set of initial children exists and not reacting to changes in them.</li>
</ul>
</section>
<section>
<h3>Dissenting Opinion</h3>
<ul>
<li>Some people believe using a MutationObserver is enough to cover the insertion/removal cases and want to avoid creating a duplicate similar API for custom elements. But the async nature of MutationObserver seems to cause timing issues.</li>
<li>Some other people don't want to add this API if it will only cover the use case when the parser finishes parsing children. (See the second concern)</li>
</ul>
</section>
<section>
<h3>Related Specs</h3>
<ul>
<li><a href="https://github.com/WICG/webcomponents/issues/933">slotchange event options</a></li>
</ul>
</section>
<section>
<h3>Open Questions</h3>
<ul>
<li>Should this API really cover both use cases to begin with? Arguments for both sides have been mentioned in all referenced discussions with no conclusion</li>
<li>Should this be one or two separate callback functions?</li>
<li>Would it be better to implement this behavior as <a href="https://github.com/WICG/webcomponents/issues/933">part of the slotchange event as suggested in this other issue</a>? This might lead to engine security bugs so the callback seems a better option in that regard.</li>
</ul>
</section>
</section>
<section>
<h2>Composed Selection</h2>
<section>
<h3>Links</h3>
<dl>
<dt>Previous WCCG Report(s)</dt>
<dd><a href="https://w3c.github.io/webcomponents-cg/2021.html#composed-selection">2021</a></dd>
<dt>GitHub issues:</dt>
<dd><a href="https://github.com/WICG/webcomponents/issues/79">Selection APIs for Shadow DOM (main issue)</a></dd>
<dd><a href="https://github.com/w3c/selection-api/issues/98">Add getComposedRange to Selection</a></dd>
<dd><a href="https://github.com/w3c/selection-api/issues/99">Change setBaseAndExtent</a></dd>
<dt>Browser positions:</dt>
<dd><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1430308">Mozilla open bug: Implement Selection.getComposedRange()</a></dd>
<dd><a href="https://bugs.webkit.org/show_bug.cgi?id=163921">Webkit open bug: Add selection API that works across shadow boundaries</a></dd>
</dl>
</section>
<section>
<h3>Description</h3>
<p>
Since existing Selection APIs can represent only a single selection in a document,
bound to a single Range,
the need for an API to represent ranges over a composed tree has been generally acknowledged since at least 2015.
</p><p>
This introduces a new API,
`getComposedRange()`, that can return a `StaticRange` with endpoints in different shadow trees.
It modifies several existing selection APIs,
like `setBaseAndExtent()`,
to support composed trees in a backwards-compatible way.
</p>
<p>
It also specifies a consistent behavior for `getSelection()`,
which currently behaves differently across browsers when applied to a shadow root.
</p>
</section>
<section>
<h3>Status</h3>
<ul>
<li>
Consensus on
<a href="https://github.com/mfreed7/shadow-dom-selection/blob/main/README.md">The Shadow Selection API</a>,
but no spec or implementations.
</li>
</ul>
</section>
<section>
<h3>Initial API Summary/Quick API Proposal</h3>
<pre class="javascript">
customElements.define('x-editor', class extends HTMLElement {
connectedCallback() {
super.connectedCallback();
document.addEventListener('selectionchange', () => {
const selection = window.getSelection();
const range = selection.getComposedRange({ shadowRoots: [ this.shadowRoot ] });
// use shadow-aware `range` to evaluate selection within this component
})
}
});
</pre>
</section>
<section>
<h3>Key Scenarios</h3>
<p>
Selection does not work across or within shadow roots.
<strong>This makes fully-featured rich-text editors impossible to implement with web components.</strong>
Some of the web's most popular editors have issues that are blocked on this functionality:
</p>
<ul>
<li><a href="https://github.com/tinymce/tinymce/pull/4737#issuecomment-719317085">TinyMCE</a></li>
<li><a href="https://github.com/ckeditor/ckeditor5/pull/7846#issuecomment-675477977">CKEditor</a></li>
<li><a href="https://github.com/quilljs/quill/pull/1805">Quill</a></li>
</ul>
</section>
<section>
<h3>Concerns</h3>
<ul>
<li>
Aligning all browsers behind a spec will change behavior in the wild
in any cases where cross-tree nodes are already being used.
However, since cross-root selection behavior is currently unspecified
and works differently in every browser,
the impact of this is expected to be small.
</li>
</ul>
</section>
</section>
<section>
<h2>Constructable Stylesheets & adoptedStyleSheets</h2>
<section>
<h3>Links</h3>
<dl>
<dt>Previous WCCG Report(s)</dt>
<dd><a href="https://w3c.github.io/webcomponents-cg/2021.html#constructable-stylesheets-adoptedstylesheets">2021</a></dd>
<dt>GitHub issues:</dt>
<dd><a href="https://github.com/WICG/webcomponents/issues/468">WICG/webcomponents#468</a></dd>
<dt>Browser positions:</dt>
<dd><a href="https://chromestatus.com/feature/5394843094220800" target="_blank">Chrome (Shipped)</a></dd>
<dd><a href="https://github.com/mozilla/standards-positions/issues/103" target="_blank">Mozilla (Shipped)</a></dd>
<dd><a href="https://github.com/WebKit/standards-positions/issues/42" target="_blank">Safari</a></dd>
</dl>
</section>
<section>
<h3>Description</h3>
<p><a href="https://wicg.github.io/construct-stylesheets/" target="_blank">Constructable Stylesheets</a> and adoptedStyleSheets enable adding styles directly to DOM trees, e.g. `document` and shadow roots, without creating new DOM elements. Because a single stylesheet object can be adopted by multiple scopes, it also allows sharing of styles that can be centrally modified.</p>
</section>
<section>
<h3>Status</h3>
<ul>
<li>Partial consensus; shipped in both <a href="https://web.dev/constructable-stylesheets/" target="_blank">Chrome</a> and <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1520690" target="_blank">Firefox</a></li>
</ul>
</section>
<section>
<h3>Initial API Summary/Quick API Proposal</h3>
<p>The following is <a href="https://web.dev/constructable-stylesheets/#using-constructed-stylesheets" target="_blank">an example</a> of what this would look like in practice.</p>
<pre>
const sheet = new CSSStyleSheet();
sheet.replaceSync('a { color: red; }');
// Apply the stylesheet to a document:
document.adoptedStyleSheets = [sheet];
// Apply the stylesheet to a Shadow Root:
const node = document.createElement('div');
const shadow = node.attachShadow({ mode: 'open' });
shadow.adoptedStyleSheets = [sheet];
</pre>
</section>
<section>
<h3>Key Scenarios</h3>
<ul>
<li>There is no effective way to share styles across components while allowing them to be centrally modified.</li>
<li>Creating `<style>` elements for each style used in each shadow root has a measurable performance overhead.</li>
<li>CSS Module Scripts, another critical feature, depends on constructable stylesheets.</li>
</ul>
</section>
<section>
<h3>Concerns</h3>
<p>From their standards position tracker, Safari has highlighted some of the following concerns:</p>
<ul>
<li>Issues related to <a href="https://github.com/WICG/construct-stylesheets/issues/45" target="_blank">race conditions</a> with adopting stylesheets and if the adoptedStyleSheets array should be directly mutable or not</li>
<li>There is concern that it is <a href="https://github.com/whatwg/dom/pull/892#pullrequestreview-593774559" target="_blank">incompatible with Declarative Shadow DOM</a>.</li>
<li>Outstanding questions around <a href="https://github.com/WICG/webcomponents/issues/870" target="_blank"><em>@import</em> statements in CSS Modules</a>.</li>
</ul>
</p>
</section>
<section>
<h3>Dissenting Opinion</h3>
<ul>
<li>---</li>
</ul>
</section>
<section>
<h3>Related Specs</h3>
<ul>
<li><a href="/#declarative-shadow-dom" target="_blank">Declarative Shadow DOM</a></li>
<li><a href="/#css-module-scripts" target="_blank">CSS Module Scripts</a></li>
</ul>
</section>
<section>
<h3>Open Questions</h3>
<ul>
<li>---</li>
</ul>
</section>
</section>
<section>
<h2>Cross-root ARIA</h2>
<section>
<h3>Links</h3>
<dl>
<dt>Previous WCCG Report(s)</dt>
<dd><a href="https://w3c.github.io/webcomponents-cg/2021.html#cross-root-aria">2021</a></dd>
<dt>GitHub issues:</dt>
<dd><a href="https://github.com/leobalter/cross-root-aria-delegation" target="_blank">Cross-root ARIA Delegation</a></dd>
<dd><a href="https://github.com/Westbrook/cross-root-aria-reflection" target="_blank">Cross-root ARIA Reflection</a></dd>
<dt>Browser positions:</dt>
<dd>---</dd>
</dl>
</section>
<section>
<h3>Description</h3>
<p>
Shadow boundaries prevent content on either side of the boundary from referencing each other via ID references. ID references being the basis of the majority of the accessibility patters outlines by aria attributes, this causes a major issue in developing accessible content with shadow DOM. While there are ways to develop these UIs by orchestrating the relationships between elements of synthesizing the passing of content across a shadow boundary, these practices generally position accessible development out of reach for most developers, both at component creation and component consumption time.
</p>
<p>
Developers of a custom element should be able to outline to browsers how content from outside of their shadow root realtes to the content within it and visa versa. Cross-root ARIA Delegation would allow developers to define how content on the outside is mapped to the content within a shadow root, while Cross-root ARIA Reflection would define how content within a shadow root was made available to content outside of it.
</p>
</section>
<section>
<h3>Status</h3>
<p>
Implementors participating in bi-weekly Accessibility Object Model syncs with WICG have all been favorable to the delegation work and are interested in the reflection work as a tighly related API that maybe is a fast follower. Leo Balter is working on finalizing proposal text for the delegation API at which time Westbrook Johnson will apply similar teminology to the reflection API proposal.
</p>
</section>
<section>
<h3>Initial API Summary/Quick API Proposal</h3>
<h4>Delegation API</h4>
<p>HTML</p>
<pre>
<code>
<span id="foo">Description!</span>
<template id="template1">
<input id="input" autoarialabel autoariadescribedby />
<span autoarialabel>Another target</span>
</template>
<x-foo aria-label="Hello!" aria-describedby="foo"></x-foo>
</code>
</pre>
<p>JS</p>
<pre>
<code>
const template = document.getElementById('template1');
class XFoo extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: "open", delegatesAriaLabel: true, delegatesAriaDescribedBy: true });
this.shadowRoot.appendChild(template.content.cloneNode(true));
}
}
customElements.define("x-foo", XFoo);
</code>
</pre>
<h4>Reflection API</h4>
<p>HTML</p>
<pre>
<code>
<input aria-controlls="foo" aria-activedescendent="foo">Description!</span>
<template id="template1">
<ul reflectariacontrols>
<li>Item 1</li>
<li reflectariaactivedescendent>Item 2</li>
<li>Item 3</li>
</ul>
</template>
<x-foo id="foo"></x-foo>
</code>
</pre>
<p>JS</p>
<pre>
<code>
const template = document.getElementById('template1');
class XFoo extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: "open", reflectsAriaControls: true, reflectsAriaActivedescendent: true });
this.shadowRoot.appendChild(template.content.cloneNode(true));
}
}
customElements.define("x-foo", XFoo);
</code>
</pre>
</section>
<section>
<h3>Key Scenarios</h3>
<p>When developing many of the patterns outlines in the <a href="https://www.w3.org/WAI/ARIA/apg/patterns/" target="_blank">ARIA Authoring Practices Guide</a> having this capability would allow for encapsulating responsibilities outlined by the `role` attribute in a shadow root.</p>
</section>
<section>
<h3>Related Specs</h3>
<ul>
<li><a href="https://github.com/WICG/aom" target="_blank">AOM</a></li>
<li><a href="https://wicg.github.io/aom/aria-reflection-explainer.html" target="_blank">ARIA Reflection</a></li>
<li><a href="https://github.com/WICG/aom/blob/gh-pages/element_reference_properties.md" target="_blank">Element reference DOM properties</a></li>
</ul>
</section>
<section>
<h3>Open Questions</h3>
<ul>
<li>Should these two ideas can/should really ship separately? While the reflection API was ideated after the delegation API it may not be practical to separate them at the implementation/consumption level.</li>
<li>Is `delegation` and `reflection` the right name for these APIs? Particularly, "reflection" is used in <a href="https://wicg.github.io/aom/aria-reflection-explainer.html" target="_blank">ARIA Reflection</a>.</li>
<li>There are non-ARIA attributes that would benefit from being supported by these APIs. Should they be drafted in a more general way?</li>
</ul>
</section>
</section>
<section>
<h2>CSS Module Scripts</h2>
<section>
<h3>Links</h3>
<dl>
<dt>Previous WCCG Report(s)</dt>
<dd><a href="https://w3c.github.io/webcomponents-cg/2021.html#css-module-scripts">2021</a></dd>
<dt>GitHub issues:</dt>
<dd><a href="https://github.com/WICG/webcomponents/issues/759">WICG/webcomponents#759</a></dd>
<dt>Browser positions:</dt>
<dd><a href="https://web.dev/css-module-scripts/">Chrome</a></dd>
<dd><a href="https://mozilla.github.io/standards-positions/#import-attributes">Firefox</a></dd>
</dl>
</section>
<section>
<h3>Description</h3>
<p>CSS Module Scripts allow JavaScript modules to import style sheets. They can then be applied to a document or shadow root using adoptedStyleSheets in the same way as constructable style sheets.</p>
</section>
<section>
<h3>Status</h3>
<ul>
<li><a href="https://chromestatus.com/feature/5948572598009856">Chrome (shipped)</a></li>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1720570">Firefox</a></li>
<li><a href="https://bugs.webkit.org/show_bug.cgi?id=227967">Safari</a></li>
</ul>
</section>
<section>
<h3>Initial API Summary/Quick API Proposal</h3>
<pre class="javascript">
import styleSheet from "./styles.css" assert { type: "css" };
document.adoptedStyleSheets = [ styleSheet ];
</pre>
</section>
<section>
<h3>Key Scenarios</h3>
<h3>Motivation</h3>
<ul>
<li>CSS modules will allow styles to be loaded in component definitions without adding `<style>` or `<link>` elements that need to be created in each element instance.</li>
<li>Authors today often use inlined CSS strings in JS modules, but many of them want to move the CSS into separate .css files.</li>
<li>Without CSS-in-JS it's difficult to ensure that CSS is loaded before the component is defined and rendered. CSS module scripts provide the same ordering guarantee.</li>
<li>Component authors may need to import a resource that is only available as an external .css file, and don't have control over the resource to wrap it in a JS module.</li>
</ul>
<p>For further motivational details, see this explainer document: <a href="https://github.com/WICG/webcomponents/blob/gh-pages/proposals/css-modules-v1-explainer.md#why-are-css-modules-needed">webcomponents/css-modules-v1-explainer.md at gh-pages · WICG/webcomponents</a>.</p>
</section>
<section>
<h3>Concerns</h3>
<ul>
<li>Safari has a security concern regarding <a href="https://github.com/w3ctag/design-reviews/issues/405#issuecomment-535478821">the result of a loaded module.</a></li>
<li>Safari wants to better understand <a href="https://github.com/w3ctag/design-reviews/issues/405#issuecomment-561304217">how to handle <code>@import</code> statements in CSS Modules.</a></li>
</ul>
</section>
<section>
<h3>Dissenting Opinion</h3>
<ul>
<li>---</li>
</ul>
</section>
<section>
<h3>Related Specs</h3>
<ul>
<li>This has a pre-requisite on <a href="#constructable-stylesheets-adoptedstylesheets">Constructable Stylesheets</a> landing.</li>
</ul>
</section>
<section>
<h3>Open Questions</h3>
<ul>
<li>---</li>
</ul>
</section>
</section>
<section>
<h2>CSS Properties and values inside shadow root</h2>
<section>
<h3>Links</h3>
<dl>
<dt>Previous WCCG Report(s)</dt>
<dd>N/A</dd>
<dt>GitHub issues:</dt>
<dd>---</dd>
<dt>Browser positions:</dt>
<dd>---</dd>
</dl>
</section>
<section>
<h3>Description</h3>
<p>---</p>
</section>
<section>
<h3>Status</h3>
<ul>
<li>---</li>
</ul>
</section>
<section>
<h3>Initial API Summary/Quick API Proposal</h3>
<p>Summary or proposal based on current status; paragraph(s) and code.</p>
</section>
<section>
<h3>Key Scenarios</h3>
<p>---</p>
</section>
<section>
<h3>Concerns</h3>
<ul>
<li>---</li>
</ul>
</section>
<section>
<h3>Dissenting Opinion</h3>
<ul>
<li>---</li>
</ul>
</section>
<section>
<h3>Related Specs</h3>
<ul>
<li>---</li>
</ul>
</section>
<section>
<h3>Open Questions</h3>
<ul>
<li>---</li>
</ul>
</section>
</section>
<section>
<h2>Custom Attributes</h2>
<section>
<h3>Links</h3>
<dl>
<dt>Previous WCCG Report(s)</dt>
<dd>N/A</dd>
<dt>GitHub issues:</dt>
<dd>
<ul>
<li>
<a href="https://github.com/w3c/webcomponents-cg/discussions/31#discussioncomment-3163644">Discussion</a>
</li>
<li>
<a href="https://github.com/whatwg/html/issues/2271">Custom Attribute Name Rules</a>
</li>
<li>
<a href="https://github.com/whatwg/dom/issues/533#issuecomment-405530738">Node Connectedness comment about Custom Attributes</a>
</li>
</ul>
</dd>
<dt>Browser positions:</dt>
<dd>---</dd>
</dl>
</section>
<section>
<h3>Description</h3>
<p>Enable developers to create reusable custom behaviors that that can be declaratively applied to any element.</p>
</section>
<section>
<h3>Status</h3>
<ul>
<li>
No official proposal yet.
</li>
<li>
While there is no official issue for this yet, this feature request crops up in several discussions on other threads. In general, the community seems to be very interested in having something like this.
</li>
</ul>
</section>
<section>
<h3>Initial API Summary/Quick API Proposal</h3>
<p>There is no issue or proposal yet. The following can serve as an initial idea, inspired by custom elements.</p>
<pre class="javascript">
class MaterialRipple extends Attr {
// ownerElement inherited from Attr
// name inherited from Attr
// value inherited from Attr
// ...
connectedCallback () {
// called when the ownerElement is connected to the DOM
}
disconnectedCallback () {
// called when the ownerElement is disconnected from the DOM
}
attributeChangedCallback() {
// called when the value property of this attribute changes
}
}
customAttributes.define("material-ripple", MaterialRipple);
</pre>
</section>
<section>
<h3>Key Scenarios</h3>
<p>
<ul>
<li>Enable more built-in patterns to be accomplishable by developer extensions. e.g. label for, img src</li>
<li>Enable behaviors to be written once and used on any element.</li>
<li>May serve as a better solution than the "is" capability of custom elements (which isn't fully supported).</li>
</ul>
</p>
</section>
<section>
<h3>Concerns</h3>
<p>No concerns yet.</p>
</section>
<section>
<h3>Dissenting Opinion</h3>
<p>No dissenting opinions yet.</p>
</section>
<section>
<h3>Related Specs</h3>
<ul>
<li>
<a href="#declarative-shadow-dom">Declarative Shadow DOM</a>
</li>
<li>
<a href="#lazy-custom-element-definitions">Lazy Custom Element Definitions</a>
</li>
<li>
<a href="#dom-parts">DOM Part API</a>
</li>
<li>
<a href="#scoped-element-registries">Scoped Custom Element Registries</a>
</li>
<li>
<a href="https://github.com/WICG/webcomponents/blob/gh-pages/proposals/Template-Instantiation.md">Template Instantiation</a>
</li>
</ul>
</section>
<section>
<h3>Open Questions</h3>
<ul>
<li>
How should custom attributes be named? Can they follow the same hyphen convention as custom elements?
</li>
<li>
SVG has some CSS properties that it surfaces as attributes. How do we prevent conflicts?
</li>
<li>
It could be beneficial for a custom attribute to have access to the shadow DOM of a custom element, but is this a security issue?
</li>
<li>
Should we allow access to ElementInternals? Is that a security problem? Is there a limited version of this we could support? Do custom elements need to allow this? What about built-ins?
</li>
<li>
How to handle when "removeAttribute" is called?
</li>
<li>
Should there be special handling for boolean attributes?
</li>
<li>
Should there be a specific set of pre-defined attributes that can be opted into for custom elements. e.g. for, src
</li>
</ul>
</section>
</section>
<section>
<h2>Custom CSS State</h2>
<section>
<h3>Links</h3>
<dl>
<dt>Previous WCCG Report(s)</dt>
<dd>N/A</dd>
<dt>GitHub issues:</dt>
<dd>https://github.com/WICG/webcomponents/issues/738</dd>
<dt>Browser positions:</dt>
<dd>
<ul>
<li>
<strong>Chrome</strong> — shipped
</li>
<li>
<strong>Firefox</strong> — <a href="https://github.com/mozilla/standards-positions/issues/688">Mozilla position (GitHub issue)</a>
</li>
<li>
<strong>Webkit</strong> — <a href="https://github.com/WebKit/standards-positions/issues/56">WebKit position (GitHub issue)</a>
</li>
</ul>
</dd>
</dl>
</section>
<section>
<h3>Description</h3>
<blockquote cite="https://wicg.github.io/custom-state-pseudo-class/#motivation">
<p>Build-in elements provided by user agents have certain “states” that can change over time depending on user interaction and other factors, and are exposed to web authors through pseudo classes. For example, some form controls have the “invalid” state, which is exposed through the :invalid pseudo-class.</p>
<p>Like built-in elements, custom elements can have various states to be in too, and custom element authors want to expose these states in a similar fashion as the built-in elements.</p>
</blockquote>
</section>
<section>
<h3>Status</h3>
<ul>
<li>A <a href="https://wicg.github.io/custom-state-pseudo-class/#exposing">draft of the spec has been written in WICG</a>.</li>
</ul>
</section>
<section>
<h3>Initial API Summary/Quick API Proposal</h3>
<p>The <code>CustomStateSet</code> API allows component authors to expose internal component state for use in styling or other element-matching operations (such as <code>querySelector</code></p>
<p>This is different from a custom element sprouting a class (via <code>this.classList.add</code> in any state added to the custom element can be seen as internal (similar to the <code>:checked</code> pseud-selector for input elements).</code></p>
<p>To allow for this operation, a set-like API is exposed at <code>ElementInternals.prototype.states</code>, meaning that only custom elements can apply custom states. An example might look like the following:</p>
<pre>
<code>
class FancyElement extends HTMLElement {
#internals = this.attachInternals();
constructor() {
super();
const root = this.attachShadow({ mode: 'open' });
const button = document.createElement('button');
button.innerText = 'Add clicked state';
button.setAttribute('part', 'btn');
root.append(button);
this.addEventListener('click', function wasClicked() {
this.#internals.states.add('--clicked');
this.removeEventListener('click', wasClicked);
});
}
}
customElements.define('fancy-element', FancyElement);
</code>
</pre>
<p>Consumers of the <code>fancy-element</code> code can now take advantage of the <code>:--clicked</code> state in CSS or in any DOM querying API to modify or select the relevant element once clicked.</p>
<p>For example, to change the background of the element's <code>btn</code> part, a consuming developer could apply the following CSS:</p>
<pre>
<code>
:--clicked::part(btn) {
background: rebeccapurple;
}
</code>
</pre>
<p>Alternatively, a consuming developer could call <code>document.querySelectorAll(':--clicked')</code> to target all elements with the custom state.</p>
</section>
<section>
<h3>Key Scenarios</h3>
<ul>
<li>Allow custom element authors to expose internal state for use in CSS</li>
<li>Allow custom element authros to expose internal state for use in DOM selection operations</li>
</ul>
</section>
<section>
<h3>Concerns</h3>
<ul>
<li>Most of the concerns around this topic are related to syntax rather than functionality. For example, some prefer the selector to match state to be something along the lines of <code>:state(--state)</code>; however, it appears as if the current status is fairly accepted right now.</li>
</ul>
</section>
<section>
<h3>Related Specs</h3>
<ul>
<li><a href="https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-face-example">Form-associated custom elements</a></li>
</ul>
</section>
</section>
<section>
<h2>Declarative CSS Modules</h2>
<section>
<h3>Links</h3>
<dl>
<dt>Previous WCCG Report(s)</dt>
<dd><a href="https://w3c.github.io/webcomponents-cg/2021.html#declarative-css-modules">2021</a></dd>
<dt>GitHub issues:</dt>
<dd>---</dd>
<dt>Browser positions:</dt>
<dd>---</dd>
</dl>
</section>
<section>
<h3>Description</h3>
<p>---</p>
</section>
<section>
<h3>Status</h3>
<ul>
<li>---</li>
</ul>
</section>
<section>
<h3>Initial API Summary/Quick API Proposal</h3>
<p>Summary or proposal based on current status; paragraph(s) and code.</p>
</section>
<section>
<h3>Key Scenarios</h3>
<p>---</p>
</section>
<section>
<h3>Concerns</h3>
<ul>
<li>---</li>
</ul>
</section>
<section>
<h3>Dissenting Opinion</h3>
<ul>
<li>---</li>
</ul>
</section>
<section>
<h3>Related Specs</h3>
<ul>
<li>---</li>
</ul>
</section>
<section>
<h3>Open Questions</h3>
<ul>
<li>---</li>
</ul>
</section>
</section>
<section>
<h2>Declarative custom elements</h2>
<section>
<h3>Links</h3>
<dl>
<dt>Previous WCCG Report(s)</dt>
<dd><a href="https://w3c.github.io/webcomponents-cg/2021.html#declarative-custom-elements">2021</a></dd>
<dt>GitHub issues:</dt>
<dd>
<ul>
<li><a href="https://github.com/WICG/webcomponents/blob/gh-pages/proposals/Declarative-Custom-Elements-Strawman.md">Initial Proposal</a></li>
<li><a href="https://github.com/Westbrook/custom-element-proposals/pull/1">Single File Component Explainer</a></li>
<li><a href="https://github.com/WICG/webcomponents/issues/645">Cross-over with HTML Modules</a></li>
<li><a href="https://github.com/w3c/webcomponents-cg/issues/32">Discussion</a></li>
</ul>
</dd>
<dt>Browser positions:</dt>
<dd>---</dd>
</dl>
</section>
<section>