Commit ba5534a
Use slot fallback to render optgroup label attr
Instead of setting display:none on the element which holds the label
attribute when a legend element is present, we can put the label
attribute holding element as a child of a new slot for the legend
element, so it automatically gets rendered when there is no legend
element.
The legend element is only supposed to be the first element in the
optgroup as per the content model in the HTML spec, so this patch also
enforces that by only slotting the legend element in when it is the
first child element. Allowing or using the legend element inside of
optgroups was a new feature with customizable select, so compat risk is
low.
Context: whatwg/html#12201 (comment)
There are a11y test expectations because the UA shadowroot is being
changed, but this should not be visible to ATs because the new nodes are
marked as invisible and ignored, and only appear in the internal "blink"
a11y trees as opposed to real platform trees.
Change-Id: I776fee963146abbad2028638479df7d3362c35ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7629416
Reviewed-by: Joey Arhar <jarhar@chromium.org>
Reviewed-by: David Baron <dbaron@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1649235}1 parent ac4b280 commit ba5534a
2 files changed
Lines changed: 27 additions & 1 deletion
File tree
- html/semantics/forms/the-select-element/customizable-select
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| |||
0 commit comments