Skip to content

Commit 6d8abdf

Browse files
committed
Add UA stylesheet for <select> base appearance
1 parent 831a387 commit 6d8abdf

File tree

1 file changed

+178
-0
lines changed

1 file changed

+178
-0
lines changed

source

+178
Original file line numberDiff line numberDiff line change
@@ -135843,6 +135843,184 @@ progress { appearance: auto; }</code></pre>
135843135843

135844135844
</div>
135845135845

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

135847136025
<div w-nodev>
135848136026

0 commit comments

Comments
 (0)