Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UA stylesheet for <select> base appearance #10670

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -3994,6 +3994,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li>The concept <dfn data-x-href="https://drafts.csswg.org/css-ui/#widget">widget</dfn></li>
<li>The concept <dfn data-x-href="https://drafts.csswg.org/css-ui/#native-appearance">native appearance</dfn></li>
<li>The concept <dfn data-x-href="https://drafts.csswg.org/css-ui/#primitive-appearance">primitive appearance</dfn></li>
<li>The concept <dfn data-x-href="https://drafts.csswg.org/css-ui/#base-appearance">base appearance</dfn></li>
<li>The concept <dfn data-x-href="https://drafts.csswg.org/css-ui/#element-with-default-preferred-size">element with default preferred size</dfn></li>
<li>The <dfn data-x-href="https://drafts.csswg.org/css-ui/#non-devolvable">non-devolvable widget</dfn> and
<dfn data-x-href="https://drafts.csswg.org/css-ui/#devolvable">devolvable widget</dfn> classification, and the related
Expand Down Expand Up @@ -137247,6 +137248,109 @@ progress { appearance: auto; }</code></pre>

</div>

<!-- TODO should this go at the top of the section right below "the select element"? -->
<p>The following styles are expected to apply to <code>select</code> elements when they are being
rendered as a <span>drop-down box</span> with <span>base appearance</span>:</p>

<pre><code class="css">@namespace "http://www.w3.org/1999/xhtml";

select {
padding-block: 0.25em;
padding-inline: 0.5em;
border-radius: 0.5em;
min-block-size: max(24px, 1lh);
min-inline-size: 24px;
box-sizing: border-box;
display: inline-flex;
gap: 1em;
border: 1px solid currentColor;
background-color: transparent;
color: inherit;
user-select: none;
}

select > button:first-child {
all: unset;
display: contents;
interactivity: inert;
}

::picker(select) {
color: CanvasText;
background-color: Canvas;
border: 1px solid;
box-sizing: border-box;
padding: 0;
inset: auto;
margin: 0;
min-inline-size: anchor-size(self-inline);
min-block-size: 1lh;
max-block-size: stretch;
overflow: auto;
position-area: block-end span-inline-end;
position-try-order: most-block-size;
position-try-fallbacks:
block-start span-inline-end,
block-end span-inline-start,
block-start span-inline-start;
}

select option {
min-inline-size: 24px;
min-block-size: max(24px, 1lh);
align-content: center;
display: flex;
place-items: center;
gap: 0.5em;
white-space: nowrap;
}

select optgroup {
font-weight: bolder;
}

select optgroup option {
font-weight: normal;
}

select legend,
select option {
padding-inline: 0.5em;
}

select option::checkmark {
content: '\2713' / '';
}
select option:not(:checked)::checkmark {
visibility: hidden;
}
select::picker-icon {
margin-inline-start: auto;
display: block;
content: counter(fake-counter-name, disclosure-open);
}

select:enabled:hover {
background-color: color-mix(in lab, currentColor 10%, transparent);
}
select:enabled:active {
background-color: color-mix(in lab, currentColor 20%, transparent);
}
select:disabled {
color: color-mix(in srgb, currentColor 50%, transparent);
}

select option:enabled:hover {
background-color: color-mix(in lab, currentColor 10%, transparent);
}
select option:enabled:active {
background-color: color-mix(in lab, currentColor 20%, transparent);
}
select option:disabled {
color: color-mix(in lab, currentColor 50%, transparent);
}</code></pre>



<div w-nodev>

Expand Down