Skip to content

Commit a7344f5

Browse files
committed
Add UA stylesheet for <select> base appearance
1 parent ac8f49b commit a7344f5

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
@@ -135862,6 +135862,184 @@ progress { appearance: auto; }</code></pre>
135862135862

135863135863
</div>
135864135864

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

135866136044
<div w-nodev>
135867136045

0 commit comments

Comments
 (0)