Skip to content

Commit cf68cc6

Browse files
committed
Add UA stylesheet for <select> base appearance
1 parent 30a4748 commit cf68cc6

File tree

1 file changed

+178
-0
lines changed

1 file changed

+178
-0
lines changed

source

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135860,6 +135860,184 @@ progress { appearance: auto; }</code></pre>
135860135860

135861135861
</div>
135862135862

135863+
<!-- TODO should this go at the top of the section right below "the select element"? -->
135864+
<!-- TODO keep this up to date with chromium prototype. -->
135865+
<!-- TODO the pseudo element names are not decided on yet. -->
135866+
<!-- TODO file a spec issue, probably in csswg, to get consensus on these values. -->
135867+
<p>The following styles are expected to apply to <code>select</code> elements when they are being
135868+
rendered as a <span>drop-down box</span> with <span>base appearance</span>:</p>
135869+
135870+
<pre><code class="css">@namespace "http://www.w3.org/1999/xhtml";
135871+
135872+
select {
135873+
background-color: transparent;
135874+
border: 0px none transparent;
135875+
135876+
select > datalist,
135877+
select::select-fallback-datalist {
135878+
box-shadow: 0px 12.8px 28.8px rgba(0, 0, 0, 0.13), 0px 0px 9.2px rgba(0, 0, 0, 0.11);
135879+
box-sizing: border-box;
135880+
overflow: auto;
135881+
border: 1px solid rgba(0, 0, 0, 0.15);
135882+
border-radius: 0.25em;
135883+
padding-block: 0.25em;
135884+
padding-inline: 0;
135885+
background-color: Field;
135886+
margin: 0;
135887+
inset: auto;
135888+
min-inline-size: anchor-size(self-inline);
135889+
min-block-size: 1lh;
135890+
inset-block-start: anchor(self-end);
135891+
inset-inline-start: anchor(self-start);
135892+
position-try:
135893+
-internal-select-datalist-reverse-block,
135894+
-internal-select-datalist-reverse-inline,
135895+
-internal-select-datalist-reverse-both,
135896+
-internal-select-datalist-default-fill,
135897+
-internal-select-datalist-reverse-block-fill,
135898+
-internal-select-datalist-reverse-inline-fill,
135899+
-internal-select-datalist-reverse-both-fill;
135900+
}
135901+
135902+
/* Fallbacks without vertical scrolling */
135903+
@position-try -internal-select-fallback-datalist-reverse-block {
135904+
inset: auto;
135905+
/* Reverse block axis */
135906+
inset-block-end: anchor(self-start);
135907+
inset-inline-start: anchor(self-start);
135908+
}
135909+
@position-try -internal-select-fallback-datalist-reverse-inline {
135910+
inset: auto;
135911+
/* Reverse inline axis */
135912+
inset-block-start: anchor(self-end);
135913+
inset-inline-end: anchor(self-end);
135914+
}
135915+
@position-try -internal-select-fallback-datalist-reverse-both {
135916+
inset: auto;
135917+
/* Reverse both axes */
135918+
inset-block-end: anchor(self-start);
135919+
inset-inline-end: anchor(self-end);
135920+
}
135921+
135922+
/* Fallbacks with vertical scrolling */
135923+
@position-try -internal-select-fallback-datalist-default-fill {
135924+
inset: auto;
135925+
inset-block-start: anchor(self-end);
135926+
inset-inline-start: anchor(self-start);
135927+
block-size: -webkit-fill-available;
135928+
}
135929+
@position-try -internal-select-fallback-datalist-reverse-block-fill {
135930+
inset: auto;
135931+
/* Reverse block axis */
135932+
inset-block-end: anchor(self-start);
135933+
inset-inline-start: anchor(self-start);
135934+
block-size: -webkit-fill-available;
135935+
}
135936+
@position-try -internal-select-fallback-datalist-reverse-inline-fill {
135937+
inset: auto;
135938+
/* Reverse inline axis */
135939+
inset-block-start: anchor(self-end);
135940+
inset-inline-end: anchor(self-end);
135941+
block-size: -webkit-fill-available;
135942+
}
135943+
@position-try -internal-select-fallback-datalist-reverse-both-fill {
135944+
inset: auto;
135945+
/* Reverse both axes */
135946+
inset-block-end: anchor(self-start);
135947+
inset-inline-end: anchor(self-end);
135948+
block-size: -webkit-fill-available;
135949+
}
135950+
135951+
select > datalist,
135952+
select::select-fallback-datalist {
135953+
position: fixed;
135954+
width: fit-content;
135955+
height: fit-content;
135956+
color: CanvasText;
135957+
}
135958+
select > datalist:popover-open,
135959+
select::select-fallback-datalist:popover-open {
135960+
overlay: auto !important;
135961+
display: block;
135962+
}
135963+
select > datalist:-internal-popover-in-top-layer::backdrop,
135964+
select::select-fallback-datalist:-internal-popover-in-top-layer::backdrop {
135965+
position: fixed;
135966+
inset: 0;
135967+
pointer-events: none !important;
135968+
background-color: transparent;
135969+
}
135970+
135971+
select:open > datalist {
135972+
display: block;
135973+
}
135974+
135975+
select::select-fallback-button {
135976+
color: FieldText;
135977+
background-color: Field;
135978+
appearance: none;
135979+
padding: 0.25em;
135980+
border: 1px solid ButtonBorder;
135981+
cursor: default;
135982+
font-size: inherit;
135983+
text-align: inherit;
135984+
display: inline-flex;
135985+
flex-grow: 1;
135986+
flex-shrink: 1;
135987+
align-items: center;
135988+
overflow-x: hidden;
135989+
overflow-y: hidden;
135990+
}
135991+
135992+
select::select-fallback-button-icon {
135993+
opacity: 1;
135994+
outline: none;
135995+
margin-inline-start: 0.25em;
135996+
padding-block: 2px;
135997+
padding-inline: 3px;
135998+
block-size: 1.0em;
135999+
inline-size: 1.2em;
136000+
min-inline-size: 1.2em;
136001+
max-inline-size: 1.2em;
136002+
display: block;
136003+
136004+
color: light-dark(black, white);
136005+
stroke: currentColor;
136006+
stroke-width: 3;
136007+
stroke-linejoin: round;
136008+
}
136009+
136010+
select::select-fallback-button-text {
136011+
color: inherit;
136012+
min-inline-size: 0px;
136013+
max-block-size: 100%;
136014+
flex-grow: 1;
136015+
flex-shrink: 1;
136016+
overflow: hidden;
136017+
display: inline;
136018+
}
136019+
136020+
select option:not(:disabled):hover {
136021+
background-color: SelectedItem;
136022+
color: SelectedItemText;
136023+
}
136024+
136025+
select option {
136026+
/* min-size rules ensure that we meet accessibility guidelines for minimum target size.
136027+
* https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html */
136028+
min-inline-size: 24px;
136029+
min-block-size: max(24px, 1.2em);
136030+
align-content: center;
136031+
}
136032+
136033+
select option::before {
136034+
content: '\2713' / '';
136035+
}
136036+
select option:not(:checked)::before {
136037+
visibility: hidden;
136038+
}</code></pre>
136039+
136040+
135863136041

135864136042
<div w-nodev>
135865136043

0 commit comments

Comments
 (0)