Skip to content

Commit 84bf1e8

Browse files
authored
Define base appearance for list box select elements
Fixes #11477.
1 parent 905b721 commit 84bf1e8

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
@@ -56120,8 +56120,8 @@ interface <dfn interface>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
5612056120
options</span> (either through a click, or through unfocusing the element after changing its
5612156121
value, or through a <span data-x="option-command">menu command</span>, or through any other
5612256122
mechanism) by running the <span data-x="concept-select-pick">pick an option</span> algorithm given
56123-
the <code>select</code> element, the <code>option</code> element, and if <code>select</code> and
56124-
its <span>select popover</span> are both being rendered with <span>base appearance</span>, a
56123+
the <code>select</code> element, the <code>option</code> element, and if the
56124+
<span><code>select</code>'s <code>option</code>s are being rendered with base appearance</span>, a
5612556125
corresponding <code data-x="event-keydown">keydown</code> or <code
5612656126
data-x="event-mouseup">mouseup</code> event, otherwise null.</p>
5612756127
</div>
@@ -56201,10 +56201,10 @@ interface <dfn interface>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
5620156201
</div>
5620256202

5620356203
<div algorithm>
56204-
<p>If the <code>select</code> is being rendered as a <span>drop-down box</span> with <span>base
56205-
appearance</span>, then the user agent should allow the user to <dfn>focus another option</dfn>
56206-
given the new <code>option</code> element to focus <var>option</var> and a <code
56207-
data-x="event-keydown">keydown</code> event <var>event</var>:</p>
56204+
<p>If the <code>select</code> is being rendered with <span>base appearance</span>, then the user
56205+
agent should allow the user to <dfn>focus another option</dfn> given the new <code>option</code>
56206+
element to focus <var>option</var> and a <code data-x="event-keydown">keydown</code> event
56207+
<var>event</var>:</p>
5620856208

5620956209
<ol>
5621056210
<li><p>If <var>event</var>'s <span>canceled flag</span> is set, then return.</p></li>
@@ -148084,6 +148084,11 @@ progress { appearance: auto; }</code></pre>
148084148084
appearance</span> in addition to <span>native appearance</span> and <span>primitive
148085148085
appearance</span>.</p>
148086148086

148087+
<p><code>select</code> elements which render as a <span>drop-down box</span> without the <code
148088+
data-x="attr-select-multiple">multiple</code> attribute or as a <span>list box</span> support a
148089+
<span>base appearance</span> in addition to <span>native appearance</span> and <span>primitive
148090+
appearance</span>.</p>
148091+
148087148092
<p>The <code>select</code> element's <span>select popover</span> supports a <span>base
148088148093
appearance</span> and a <span>native appearance</span>. The <span>select popover</span> can only
148089148094
be rendered with <span>base appearance</span> if its associated <code>select</code> is being
@@ -148126,32 +148131,59 @@ progress { appearance: auto; }</code></pre>
148126148131
appearance</span> separately from the <code>select</code> element. Otherwise, a native picker is
148127148132
used.</p>
148128148133

148134+
<p>When a <code>select</code> is being rendered as a <span>list box</span> with <span>base
148135+
appearance</span>, it is expected to render with a <span>shadow tree</span> that contains a
148136+
<dfn>select list box slot</dfn>, which is a <code>slot</code> element. The <span>select list box
148137+
slot</span> is appended to the <code>select</code>'s <span>shadow root</span> as the first child.
148138+
The <span>select list box slot</span> is expected to take all children of the <code>select</code>
148139+
element.</p>
148140+
148129148141
<p>The <span>select popover</span>'s <span>implicit anchor element</span> is its associated
148130148142
<code>select</code> element.</p>
148131148143

148132148144
<p>When a <code>select</code> element is being rendered with <span>native appearance</span> or
148133-
<span>primitive appearance</span>, the <span>'::picker'</span> pseudo-element and the
148145+
<span>primitive appearance</span>, or the <code>select</code> element is being rendered as a
148146+
<span>list box</span>, the <span>'::picker'</span> pseudo-element and the
148134148147
<span>'::picker-icon'</span> pseudo-element do not apply.</p>
148135148148

148136148149
<p>The <span>'::picker'</span> pseudo-element is not rendered when it has <span>native
148137148150
appearance</span> or <span>primitive appearance</span>.</p>
148138148151

148139148152
<p>The <span>'::checkmark'</span> pseudo-element only applies to <code>option</code> elements
148140-
which are inside a <code>select</code> element with <span>base appearance</span> whose
148141-
<span>'::picker'</span> pseudo-element has <span>base appearance</span>.</p>
148153+
which are <span data-x="option-base-appearance">being rendered with base appearance</span>.</p>
148142148154

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

148146-
<p>An <code>option</code> element is <span>expected</span> to be rendered by displaying the
148147-
result of <span>collect option text</span> given the <code>option</code> and true, indented under
148148-
its <code>optgroup</code> element if it has one. If the <code>option</code> is in a
148149-
<code>select</code> which is being rendered as a <span>drop-down box</span> with <span>base
148150-
appearance</span>, and the <code>select</code>'s <span>select popover</span> is being rendered
148151-
with <span>base appearance</span>, and the <code>option</code>'s <code
148152-
data-x="attr-option-label">label</code> attribute is not set, then the <code>option</code> is
148153-
<span>expected</span> to render all of its children rather than by displaying its <span
148154-
data-x="concept-option-label">label</span>.</p>
148158+
<div algorithm>
148159+
<p>To determine if a <dfn><code>select</code>'s <code>option</code>s are being rendered with base
148160+
appearance</dfn>, given a <code>select</code> element <var>select</var>:</p>
148161+
148162+
<ol>
148163+
<li><p>If <var>select</var> is being rendered as a <span>list box</span> with <span>base
148164+
appearance</span>, then return true.</p></li>
148165+
148166+
<li><p>If <var>select</var> is being rendered as a <span>drop-down box</span> with <span>base
148167+
appearance</span>, and its <span>select popover</span> is being rendered with <span>base
148168+
appearance</span>, and <var>select</var> does not have the <code
148169+
data-x="attr-select-multiple">multiple</code> attribute set, then return true.</p></li>
148170+
148171+
<li><p>Return false.</p></li>
148172+
</ol>
148173+
</div>
148174+
148175+
<p>An <code>option</code> element is <dfn data-x="option-base-appearance">rendered with base
148176+
appearance</dfn> if it has a <span data-x="option element nearest ancestor select">nearest
148177+
ancestor <code>select</code></span> and the <span><code>select</code>'s <code>option</code>s are
148178+
being rendered with base appearance</span>.</p>
148179+
148180+
<p>An <code>option</code> element is <span>expected</span> to be rendered by displaying the result
148181+
of <span>collect option text</span> given the <code>option</code> and true, indented under its
148182+
<code>optgroup</code> element if it has one. If the <code>option</code> <span
148183+
data-x="option-base-appearance">is being rendered with base appearance</span> and the
148184+
<code>option</code>'s <code data-x="attr-option-label">label</code> attribute is not set, then the
148185+
<code>option</code> is <span>expected</span> to render all of its children rather than by
148186+
displaying its <span data-x="concept-option-label">label</span>.</p>
148155148187

148156148188
<p>Each sequence of one or more child <code>hr</code> element siblings may be rendered as a single
148157148189
separator.</p>
@@ -148182,34 +148214,94 @@ progress { appearance: auto; }</code></pre>
148182148214
</div>
148183148215

148184148216
<p>The following styles are <span>expected</span> to apply to <code>select</code> elements when
148185-
they are being rendered as a <span>drop-down box</span> with <span>native appearance</span> or
148186-
<span>primitive appearance</span>:</p>
148217+
they are being rendered with <span>native appearance</span> or <span>primitive
148218+
appearance</span>:</p>
148187148219

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

148190148222
select {
148191-
display: inline-block;
148192148223
letter-spacing: initial;
148193148224
word-spacing: initial;
148194148225
line-height: initial;
148195148226
}</code></pre>
148196148227

148197148228
<p>The following styles are <span>expected</span> to apply to <code>select</code> elements when
148198-
they are being rendered as a <span>drop-down box</span> with <span>base appearance</span>:</p>
148229+
they are being rendered as a <span>drop-down box</span> with <span>native appearance</span> or
148230+
<span>primitive appearance</span>:</p>
148231+
148232+
<pre><code class="css">@namespace "http://www.w3.org/1999/xhtml";
148233+
148234+
select {
148235+
display: inline-block;
148236+
}</code></pre>
148237+
148238+
<p>The following styles are <span>expected</span> to apply to <code>select</code> elements when
148239+
they are being rendered with <span>base appearance</span>:</p>
148199148240

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

148202148243
select {
148203148244
background-color: transparent;
148204148245
border: 1px solid currentColor;
148246+
user-select: none;
148247+
box-sizing: border-box;
148248+
}
148249+
148250+
select option:enabled:hover {
148251+
background-color: color-mix(in lab, currentColor 10%, transparent);
148252+
}
148253+
select option:enabled:active {
148254+
background-color: color-mix(in lab, currentColor 20%, transparent);
148255+
}
148256+
select option:disabled {
148257+
color: color-mix(in lab, currentColor 50%, transparent);
148258+
}
148259+
148260+
select option {
148261+
min-inline-size: 24px;
148262+
min-block-size: max(24px, 1lh);
148263+
padding-inline: 0.5em;
148264+
padding-block-end: 0;
148265+
display: flex;
148266+
align-items: center;
148267+
gap: 0.5em;
148268+
white-space: nowrap;
148269+
}
148270+
148271+
select option::checkmark {
148272+
content: '\2713' / '';
148273+
}
148274+
select option:not(:checked)::checkmark {
148275+
visibility: hidden;
148276+
}
148277+
148278+
select optgroup {
148279+
font-weight: bolder;
148280+
}
148281+
148282+
select optgroup option {
148283+
font-weight: normal;
148284+
}
148285+
148286+
select optgroup legend {
148287+
padding-inline: 0.5em;
148288+
min-block-size: 1lh;
148289+
}</code></pre>
148290+
148291+
<p>The following styles are <span>expected</span> to apply to <code>select</code> elements when
148292+
they are being rendered as a <span>drop-down box</span> with <span>base appearance</span>:</p>
148293+
148294+
<pre><code class="css">@namespace "http://www.w3.org/1999/xhtml";
148295+
148296+
select {
148297+
border-radius: 0.5em;
148205148298
padding-block: 0.25em;
148206148299
padding-inline: 0.5em;
148207148300
min-block-size: calc-size(auto, max(size, 24px, 1lh));
148208148301
min-inline-size: calc-size(auto, max(size, 24px));
148209148302
display: inline-flex;
148210148303
gap: 0.5em;
148211148304
border-radius: 0.5em;
148212-
user-select: none;
148213148305
field-sizing: content !important;
148214148306
}
148215148307

@@ -148218,16 +148310,13 @@ select > button:first-child {
148218148310
display: contents;
148219148311
}
148220148312

148221-
select:enabled:hover,
148222-
select option:enabled:hover {
148313+
select:enabled:hover {
148223148314
background-color: color-mix(in lab, currentColor 10%, transparent);
148224148315
}
148225-
select:enabled:active,
148226-
select option:enabled:active {
148316+
select::enabled:active {
148227148317
background-color: color-mix(in lab, currentColor 20%, transparent);
148228148318
}
148229-
select:disabled,
148230-
select option:disabled {
148319+
select:disabled {
148231148320
color: color-mix(in lab, currentColor 50%, transparent);
148232148321
}
148233148322

@@ -148250,41 +148339,21 @@ select option:disabled {
148250148339
block-start span-inline-start;
148251148340
}
148252148341

148253-
select option {
148254-
min-inline-size: 24px;
148255-
min-block-size: max(24px, 1lh);
148256-
padding-inline: 0.5em;
148257-
padding-block-end: 0;
148258-
display: flex;
148259-
align-items: center;
148260-
gap: 0.5em;
148261-
white-space: nowrap;
148262-
}
148263-
148264-
select option::checkmark {
148265-
content: '\2713' / '';
148266-
}
148267-
select option:not(:checked)::checkmark {
148268-
visibility: hidden;
148269-
}
148270-
148271148342
select::picker-icon {
148272148343
content: counter(fake-counter-name, disclosure-open);
148273148344
display: block;
148274148345
margin-inline-start: auto;
148275-
}
148346+
}</code></pre>
148276148347

148277-
select optgroup {
148278-
font-weight: bolder;
148279-
}
148348+
<p>The following styles are <span>expected</span> to apply to <code>select</code> elements when
148349+
they are being rendered as a <span>list box</span> with <span>base appearance</span>:</p>
148280148350

148281-
select optgroup option {
148282-
font-weight: normal;
148283-
}
148351+
<pre><code class="css">@namespace "http://www.w3.org/1999/xhtml";
148284148352

148285-
select optgroup legend {
148286-
padding-inline: 0.5em;
148287-
min-block-size: 1lh;
148353+
select {
148354+
overflow: auto;
148355+
display: inline-block;
148356+
block-size: calc(max(24px, 1lh) * attr(size type(&lt;integer>), 4));
148288148357
}</code></pre>
148289148358

148290148359
<div w-nodev>

0 commit comments

Comments
 (0)