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 1 commit 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
88 changes: 88 additions & 0 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -3953,6 +3953,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 @@ -135710,6 +135711,93 @@ 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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do we define what base computes to when it's a list box?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this iteration I'm not proposing supporting base appearance on list box rendering. In chromium, I am making it do the same thing as appearance:auto, and our plan to do forward compat is to add a CSS @supports rule when appearance:base is ready for list box rendering.


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

select {
border: 1px solid currentColor;
background-color: color-mix(in lab, currentColor 10%, transparent);
color: inherit;
font: inherit;
padding: 0.25em .5em;
text-box: trim-both;

border-radius: 0.25em;
display: inline-block;
box-sizing: border-box;
min-block-size: max(24px, 1.2em);
min-inline-size: 24px;
white-space: normal;
}

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

select:enabled:active {
background-color: color-mix(in lab, currentColor 30%, transparent);
}

select::picker(select) {
box-sizing: border-box;
overflow: auto;
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 0.25em;
padding-block: 0.25em;
padding-inline: 0;
background-color: Field;
margin: 0;
inset: auto;
min-inline-size: anchor-size(self-inline);
min-block-size: 1lh;
position-area: block-end span-inline-end;
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: 24px;
align-content: center;
display: block;
padding-block-start: 0;
padding-block-end: 1px;
padding-inline: 2px;
white-space: nowrap;
}

select option:hover {
background-color: SelectedItem;
color: SelectedItemText;
}

select option::check {
content: '\2713' / '';
}
select option:not(:checked)::check {
visibility: hidden;
}

select::select-arrow {
padding-inline-start: 0.5em;
display: block;
content: counter(fake-counter-name, disclosure-open);
}

select optgroup {
padding-inline: 2px;
}

select optgroup option {
padding-inline-start: 20px;
}</code></pre>



<div w-nodev>

Expand Down