Skip to content

Commit 8d5341a

Browse files
josepharharpmeenan
authored andcommitted
Define base appearance for list box select elements
Fixes #11477.
1 parent f603a48 commit 8d5341a

File tree

1 file changed

+126
-57
lines changed

1 file changed

+126
-57
lines changed

source

Lines changed: 126 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -56221,8 +56221,8 @@ interface <dfn interface>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
5622156221
options</span> (either through a click, or through unfocusing the element after changing its
5622256222
value, or through a <span data-x="option-command">menu command</span>, or through any other
5622356223
mechanism) by running the <span data-x="concept-select-pick">pick an option</span> algorithm given
56224-
the <code>select</code> element, the <code>option</code> element, and if <code>select</code> and
56225-
its <span>select popover</span> are both being rendered with <span>base appearance</span>, a
56224+
the <code>select</code> element, the <code>option</code> element, and if the
56225+
<span><code>select</code>'s <code>option</code>s are being rendered with base appearance</span>, a
5622656226
corresponding <code data-x="event-keydown">keydown</code> or <code
5622756227
data-x="event-mouseup">mouseup</code> event, otherwise null.</p>
5622856228
</div>
@@ -56302,10 +56302,10 @@ interface <dfn interface>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
5630256302
</div>
5630356303

5630456304
<div algorithm>
56305-
<p>If the <code>select</code> is being rendered as a <span>drop-down box</span> with <span>base
56306-
appearance</span>, then the user agent should allow the user to <dfn>focus another option</dfn>
56307-
given the new <code>option</code> element to focus <var>option</var> and a <code
56308-
data-x="event-keydown">keydown</code> event <var>event</var>:</p>
56305+
<p>If the <code>select</code> is being rendered with <span>base appearance</span>, then the user
56306+
agent should allow the user to <dfn>focus another option</dfn> given the new <code>option</code>
56307+
element to focus <var>option</var> and a <code data-x="event-keydown">keydown</code> event
56308+
<var>event</var>:</p>
5630956309

5631056310
<ol>
5631156311
<li><p>If <var>event</var>'s <span>canceled flag</span> is set, then return.</p></li>
@@ -148185,6 +148185,11 @@ progress { appearance: auto; }</code></pre>
148185148185
appearance</span> in addition to <span>native appearance</span> and <span>primitive
148186148186
appearance</span>.</p>
148187148187

148188+
<p><code>select</code> elements which render as a <span>drop-down box</span> without the <code
148189+
data-x="attr-select-multiple">multiple</code> attribute or as a <span>list box</span> support a
148190+
<span>base appearance</span> in addition to <span>native appearance</span> and <span>primitive
148191+
appearance</span>.</p>
148192+
148188148193
<p>The <code>select</code> element's <span>select popover</span> supports a <span>base
148189148194
appearance</span> and a <span>native appearance</span>. The <span>select popover</span> can only
148190148195
be rendered with <span>base appearance</span> if its associated <code>select</code> is being
@@ -148227,32 +148232,59 @@ progress { appearance: auto; }</code></pre>
148227148232
appearance</span> separately from the <code>select</code> element. Otherwise, a native picker is
148228148233
used.</p>
148229148234

148235+
<p>When a <code>select</code> is being rendered as a <span>list box</span> with <span>base
148236+
appearance</span>, it is expected to render with a <span>shadow tree</span> that contains a
148237+
<dfn>select list box slot</dfn>, which is a <code>slot</code> element. The <span>select list box
148238+
slot</span> is appended to the <code>select</code>'s <span>shadow root</span> as the first child.
148239+
The <span>select list box slot</span> is expected to take all children of the <code>select</code>
148240+
element.</p>
148241+
148230148242
<p>The <span>select popover</span>'s <span>implicit anchor element</span> is its associated
148231148243
<code>select</code> element.</p>
148232148244

148233148245
<p>When a <code>select</code> element is being rendered with <span>native appearance</span> or
148234-
<span>primitive appearance</span>, the <span>'::picker'</span> pseudo-element and the
148246+
<span>primitive appearance</span>, or the <code>select</code> element is being rendered as a
148247+
<span>list box</span>, the <span>'::picker'</span> pseudo-element and the
148235148248
<span>'::picker-icon'</span> pseudo-element do not apply.</p>
148236148249

148237148250
<p>The <span>'::picker'</span> pseudo-element is not rendered when it has <span>native
148238148251
appearance</span> or <span>primitive appearance</span>.</p>
148239148252

148240148253
<p>The <span>'::checkmark'</span> pseudo-element only applies to <code>option</code> elements
148241-
which are inside a <code>select</code> element with <span>base appearance</span> whose
148242-
<span>'::picker'</span> pseudo-element has <span>base appearance</span>.</p>
148254+
which are <span data-x="option-base-appearance">being rendered with base appearance</span>.</p>
148243148255

148244148256
<p>An <code>optgroup</code> element is <span>expected</span> to be rendered by displaying the
148245148257
element's <code data-x="attr-optgroup-label">label</code> attribute.</p>
148246148258

148247-
<p>An <code>option</code> element is <span>expected</span> to be rendered by displaying the
148248-
result of <span>collect option text</span> given the <code>option</code> and true, indented under
148249-
its <code>optgroup</code> element if it has one. If the <code>option</code> is in a
148250-
<code>select</code> which is being rendered as a <span>drop-down box</span> with <span>base
148251-
appearance</span>, and the <code>select</code>'s <span>select popover</span> is being rendered
148252-
with <span>base appearance</span>, and the <code>option</code>'s <code
148253-
data-x="attr-option-label">label</code> attribute is not set, then the <code>option</code> is
148254-
<span>expected</span> to render all of its children rather than by displaying its <span
148255-
data-x="concept-option-label">label</span>.</p>
148259+
<div algorithm>
148260+
<p>To determine if a <dfn><code>select</code>'s <code>option</code>s are being rendered with base
148261+
appearance</dfn>, given a <code>select</code> element <var>select</var>:</p>
148262+
148263+
<ol>
148264+
<li><p>If <var>select</var> is being rendered as a <span>list box</span> with <span>base
148265+
appearance</span>, then return true.</p></li>
148266+
148267+
<li><p>If <var>select</var> is being rendered as a <span>drop-down box</span> with <span>base
148268+
appearance</span>, and its <span>select popover</span> is being rendered with <span>base
148269+
appearance</span>, and <var>select</var> does not have the <code
148270+
data-x="attr-select-multiple">multiple</code> attribute set, then return true.</p></li>
148271+
148272+
<li><p>Return false.</p></li>
148273+
</ol>
148274+
</div>
148275+
148276+
<p>An <code>option</code> element is <dfn data-x="option-base-appearance">rendered with base
148277+
appearance</dfn> if it has a <span data-x="option element nearest ancestor select">nearest
148278+
ancestor <code>select</code></span> and the <span><code>select</code>'s <code>option</code>s are
148279+
being rendered with base appearance</span>.</p>
148280+
148281+
<p>An <code>option</code> element is <span>expected</span> to be rendered by displaying the result
148282+
of <span>collect option text</span> given the <code>option</code> and true, indented under its
148283+
<code>optgroup</code> element if it has one. If the <code>option</code> <span
148284+
data-x="option-base-appearance">is being rendered with base appearance</span> and the
148285+
<code>option</code>'s <code data-x="attr-option-label">label</code> attribute is not set, then the
148286+
<code>option</code> is <span>expected</span> to render all of its children rather than by
148287+
displaying its <span data-x="concept-option-label">label</span>.</p>
148256148288

148257148289
<p>Each sequence of one or more child <code>hr</code> element siblings may be rendered as a single
148258148290
separator.</p>
@@ -148283,34 +148315,94 @@ progress { appearance: auto; }</code></pre>
148283148315
</div>
148284148316

148285148317
<p>The following styles are <span>expected</span> to apply to <code>select</code> elements when
148286-
they are being rendered as a <span>drop-down box</span> with <span>native appearance</span> or
148287-
<span>primitive appearance</span>:</p>
148318+
they are being rendered with <span>native appearance</span> or <span>primitive
148319+
appearance</span>:</p>
148288148320

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

148291148323
select {
148292-
display: inline-block;
148293148324
letter-spacing: initial;
148294148325
word-spacing: initial;
148295148326
line-height: initial;
148296148327
}</code></pre>
148297148328

148298148329
<p>The following styles are <span>expected</span> to apply to <code>select</code> elements when
148299-
they are being rendered as a <span>drop-down box</span> with <span>base appearance</span>:</p>
148330+
they are being rendered as a <span>drop-down box</span> with <span>native appearance</span> or
148331+
<span>primitive appearance</span>:</p>
148332+
148333+
<pre><code class="css">@namespace "http://www.w3.org/1999/xhtml";
148334+
148335+
select {
148336+
display: inline-block;
148337+
}</code></pre>
148338+
148339+
<p>The following styles are <span>expected</span> to apply to <code>select</code> elements when
148340+
they are being rendered with <span>base appearance</span>:</p>
148300148341

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

148303148344
select {
148304148345
background-color: transparent;
148305148346
border: 1px solid currentColor;
148347+
user-select: none;
148348+
box-sizing: border-box;
148349+
}
148350+
148351+
select option:enabled:hover {
148352+
background-color: color-mix(in lab, currentColor 10%, transparent);
148353+
}
148354+
select option:enabled:active {
148355+
background-color: color-mix(in lab, currentColor 20%, transparent);
148356+
}
148357+
select option:disabled {
148358+
color: color-mix(in lab, currentColor 50%, transparent);
148359+
}
148360+
148361+
select option {
148362+
min-inline-size: 24px;
148363+
min-block-size: max(24px, 1lh);
148364+
padding-inline: 0.5em;
148365+
padding-block-end: 0;
148366+
display: flex;
148367+
align-items: center;
148368+
gap: 0.5em;
148369+
white-space: nowrap;
148370+
}
148371+
148372+
select option::checkmark {
148373+
content: '\2713' / '';
148374+
}
148375+
select option:not(:checked)::checkmark {
148376+
visibility: hidden;
148377+
}
148378+
148379+
select optgroup {
148380+
font-weight: bolder;
148381+
}
148382+
148383+
select optgroup option {
148384+
font-weight: normal;
148385+
}
148386+
148387+
select optgroup legend {
148388+
padding-inline: 0.5em;
148389+
min-block-size: 1lh;
148390+
}</code></pre>
148391+
148392+
<p>The following styles are <span>expected</span> to apply to <code>select</code> elements when
148393+
they are being rendered as a <span>drop-down box</span> with <span>base appearance</span>:</p>
148394+
148395+
<pre><code class="css">@namespace "http://www.w3.org/1999/xhtml";
148396+
148397+
select {
148398+
border-radius: 0.5em;
148306148399
padding-block: 0.25em;
148307148400
padding-inline: 0.5em;
148308148401
min-block-size: calc-size(auto, max(size, 24px, 1lh));
148309148402
min-inline-size: calc-size(auto, max(size, 24px));
148310148403
display: inline-flex;
148311148404
gap: 0.5em;
148312148405
border-radius: 0.5em;
148313-
user-select: none;
148314148406
field-sizing: content !important;
148315148407
}
148316148408

@@ -148319,16 +148411,13 @@ select > button:first-child {
148319148411
display: contents;
148320148412
}
148321148413

148322-
select:enabled:hover,
148323-
select option:enabled:hover {
148414+
select:enabled:hover {
148324148415
background-color: color-mix(in lab, currentColor 10%, transparent);
148325148416
}
148326-
select:enabled:active,
148327-
select option:enabled:active {
148417+
select::enabled:active {
148328148418
background-color: color-mix(in lab, currentColor 20%, transparent);
148329148419
}
148330-
select:disabled,
148331-
select option:disabled {
148420+
select:disabled {
148332148421
color: color-mix(in lab, currentColor 50%, transparent);
148333148422
}
148334148423

@@ -148351,41 +148440,21 @@ select option:disabled {
148351148440
block-start span-inline-start;
148352148441
}
148353148442

148354-
select option {
148355-
min-inline-size: 24px;
148356-
min-block-size: max(24px, 1lh);
148357-
padding-inline: 0.5em;
148358-
padding-block-end: 0;
148359-
display: flex;
148360-
align-items: center;
148361-
gap: 0.5em;
148362-
white-space: nowrap;
148363-
}
148364-
148365-
select option::checkmark {
148366-
content: '\2713' / '';
148367-
}
148368-
select option:not(:checked)::checkmark {
148369-
visibility: hidden;
148370-
}
148371-
148372148443
select::picker-icon {
148373148444
content: counter(fake-counter-name, disclosure-open);
148374148445
display: block;
148375148446
margin-inline-start: auto;
148376-
}
148447+
}</code></pre>
148377148448

148378-
select optgroup {
148379-
font-weight: bolder;
148380-
}
148449+
<p>The following styles are <span>expected</span> to apply to <code>select</code> elements when
148450+
they are being rendered as a <span>list box</span> with <span>base appearance</span>:</p>
148381148451

148382-
select optgroup option {
148383-
font-weight: normal;
148384-
}
148452+
<pre><code class="css">@namespace "http://www.w3.org/1999/xhtml";
148385148453

148386-
select optgroup legend {
148387-
padding-inline: 0.5em;
148388-
min-block-size: 1lh;
148454+
select {
148455+
overflow: auto;
148456+
display: inline-block;
148457+
block-size: calc(max(24px, 1lh) * attr(size type(&lt;integer>), 4));
148389148458
}</code></pre>
148390148459

148391148460
<div w-nodev>

0 commit comments

Comments
 (0)