Skip to content

Commit 8beec04

Browse files
authored
[css-forms-1] Remove select styles (#13884)
These have been upstreamed to HTML so no need to duplicate them here.
1 parent a2f5595 commit 8beec04

1 file changed

Lines changed: 2 additions & 140 deletions

File tree

css-forms-1/Overview.bs

Lines changed: 2 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,6 @@ textarea,
828828
button,
829829
::file-selector-button,
830830
::color-swatch,
831-
select,
832831
meter,
833832
progress,
834833
fieldset,
@@ -847,7 +846,6 @@ textarea,
847846
button,
848847
::file-selector-button,
849848
::slider-track,
850-
select,
851849
fieldset {
852850
border: 1px solid currentColor;
853851
background-color: transparent;
@@ -976,12 +974,9 @@ input[type=radio]:checked::checkmark {
976974
977975
## Buttons (and button-like controls) ## {#stylesheet-button}
978976
979-
Selects are only button-like when they're a [drop-down box](https://html.spec.whatwg.org/multipage/rendering.html#drop-down-box).
980-
981977
```css
982978
button,
983979
::file-selector-button,
984-
select,
985980
input:is([type="color"], [type="button"], [type="reset"], [type="submit"]) {
986981
border: 1px solid currentColor;
987982
background-color: transparent;
@@ -1019,21 +1014,18 @@ input:is([type="color"], [type="button"], [type="reset"], [type="submit"]) {
10191014
}
10201015
10211016
button:enabled:hover,
1022-
select:enabled:hover,
10231017
input:is([type="color"], [type="button"], [type="reset"], [type="submit"]):enabled:hover,
10241018
input[type="file"]:enabled::file-selector-button:hover {
10251019
background-color: color-mix(currentColor 10%, transparent);
10261020
}
10271021
10281022
button:enabled:active,
1029-
select:enabled:active,
10301023
input:is([type="color"], [type="button"], [type="reset"], [type="submit"]):enabled:active,
10311024
input[type="file"]:enabled::file-selector-button:active {
10321025
background-color: color-mix(currentColor 20%, transparent);
10331026
}
10341027
10351028
button:disabled,
1036-
select:disabled,
10371029
input:is([type="color"], [type="button"], [type="reset"], [type="submit"]):disabled,
10381030
input[type="file"]:disabled::file-selector-button {
10391031
color: color-mix(currentColor 50%, transparent);
@@ -1063,138 +1055,8 @@ input[type="color"] {
10631055
10641056
## Selects ## {#stylesheet-select}
10651057
1066-
```css
1067-
select option {
1068-
/* These min-size rules ensure accessibility by following WCAG rules:
1069-
* https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html
1070-
* Unset if the author provides a child button element.
1071-
* The 1lh is there to make sure that options without text don't change
1072-
* the block size of the option. */
1073-
min-inline-size: 24px;
1074-
min-block-size: max(24px, 1lh);
1075-
1076-
/* Centers text within the block (vertically). From OpenUI discussion:
1077-
* https://github.com/openui/open-ui/issues/1026#issuecomment-2103187647. */
1078-
align-content: center;
1079-
1080-
/* centering + gap between checkmark and option content */
1081-
/* also easily reversed, when checkmark should be inline-end */
1082-
display: flex;
1083-
align-items: center;
1084-
gap: 0.5em;
1085-
1086-
/* Makes options with long text widen picker instead
1087-
* of making options tall. */
1088-
white-space: nowrap;
1089-
}
1090-
select option:enabled:hover {
1091-
background-color: color-mix(currentColor 10%, transparent);
1092-
}
1093-
select option:enabled:active {
1094-
background-color: color-mix(currentColor 20%, transparent);
1095-
}
1096-
select option:disabled {
1097-
color: color-mix(currentColor 50%, transparent);
1098-
}
1099-
select option::checkmark {
1100-
content: '\2713' / '';
1101-
}
1102-
select option:not(:checked)::checkmark {
1103-
visibility: hidden;
1104-
}
1105-
1106-
select optgroup {
1107-
display: block;
1108-
/* font-weight makes optgroups visually distinct from options. */
1109-
font-weight: bolder;
1110-
}
1111-
1112-
select optgroup option {
1113-
/* Undo font-weight:bolder rule from optgroups. */
1114-
font-weight: normal;
1115-
}
1116-
1117-
select legend,
1118-
select option {
1119-
/* spacing ownership moves to children */
1120-
/* space inline from border edges */
1121-
/* this creates a full bleed hover highlight */
1122-
padding-inline: 0.5em;
1123-
}
1124-
```
1125-
1126-
### Drop-down box selects ### {#stylesheet-dropdown-select}
1127-
1128-
These styles should apply when the select is a [drop-down box](https://html.spec.whatwg.org/multipage/rendering.html#drop-down-box).
1129-
1130-
```css
1131-
select {
1132-
field-sizing: content !important;
1133-
}
1134-
1135-
select > button:first-child {
1136-
/* Prevents button from setting font, color, or background-color */
1137-
all: unset;
1138-
1139-
/* Prevents duplicate box decorations */
1140-
display: contents;
1141-
1142-
/* Prevents button activation behavior so select can handle events */
1143-
interactivity: inert !important;
1144-
}
1145-
1146-
select::picker-icon {
1147-
/* margin-inline-start pushes the icon to the right of the box */
1148-
margin-inline-start: auto;
1149-
display: block;
1150-
content: counter(-ua-disclosure-open, disclosure-open);
1151-
}
1152-
1153-
select::picker(select) {
1154-
/* Same properties as popover and dialog */
1155-
color: CanvasText;
1156-
background-color: Canvas;
1157-
border: 1px solid;
1158-
1159-
/* box-sizing is set to match the button. */
1160-
box-sizing: border-box;
1161-
1162-
/* Remove [popover] padding which
1163-
* prevents options from extending to edges */
1164-
padding: 0;
1165-
1166-
/* Anchor positioning and scrollbars */
1167-
inset: auto;
1168-
margin: 0;
1169-
min-inline-size: anchor-size(self-inline);
1170-
min-block-size: 1lh;
1171-
/* Go to the edge of the viewport, and add scrollbars if needed. */
1172-
max-block-size: stretch;
1173-
overflow: auto;
1174-
/* Below and span-right, by default. */
1175-
position-area: self-block-end span-self-inline-end;
1176-
position-try-order: most-block-size;
1177-
position-try-fallbacks:
1178-
/* First try above and span-right. */
1179-
self-block-start span-self-inline-end,
1180-
/* Then below but span-left. */
1181-
self-block-end span-self-inline-start,
1182-
/* Then above and span-left. */
1183-
self-block-start span-self-inline-start;
1184-
}
1185-
```
1186-
1187-
### List box selects ### {#stylesheet-listbox-select}
1188-
1189-
These styles should apply when the select is a [list box](https://html.spec.whatwg.org/multipage/rendering.html#list-box).
1190-
1191-
```css
1192-
select {
1193-
overflow: auto;
1194-
display: inline-block;
1195-
block-size: calc(max(24px, 1lh) * attr(size type(<integer>), 4));
1196-
}
1197-
```
1058+
See base appearance user agent styles specified in
1059+
<a href="https://html.spec.whatwg.org/multipage/rendering.html#the-select-element-2">HTML</a>.
11981060
11991061
### Text inputs ### {#stylesheet-text-inputs}
12001062

0 commit comments

Comments
 (0)