Skip to content

Add UA stylesheet for <select> base appearance #10670

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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

josepharhar
Copy link
Contributor

@josepharhar josepharhar commented Oct 3, 2024

This PR adds a stylesheet for customizable select which applies when the select element has base appearance.

Discussion here: w3c/csswg-drafts#10857

Customizable select proposal: #9799

(See WHATWG Working Mode: Changes for more details.)


/infrastructure.html ( diff )
/rendering.html ( diff )

source Outdated
@@ -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.

@annevk annevk added the topic: select The <select> element label Nov 8, 2024
Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

@nt1m have you had a chance to review this?

@josepharhar
Copy link
Contributor Author

I just updated this PR to match the latest styles from the CSS issue.

I'm not sure what we should say about properties that are supposed to be inherited, like color and font. Should we explicitly say color:inherit? Should we have some text which says that all properties not listed here should be whatever their unset value is? Should we just say that other UA styles should not apply?

There is a bunch of UA styles in chromium I have to undo by adding extra CSS, and while I don't want to list all those properties specifically in this spec I also think it would be a good idea to mention that when implementing this feature, you have to undo those.

@domenic
Copy link
Member

domenic commented Feb 28, 2025

I think we need to list all those properties explicitly in the spec! Why would we not?

@annevk
Copy link
Member

annevk commented Feb 28, 2025

I think @josepharhar is describing Chromium's implementation of "base appearance", as in principle "base appearance" would start from an unstyled element so you would not have to undo styling, unless it was some global style.

@domenic
Copy link
Member

domenic commented Feb 28, 2025

I see. That's probably covered by the CSS spec for appearance: base then?

@josepharhar
Copy link
Contributor Author

Agreed! I'll omit the properties which have their default.

Copy link
Member

@domfarolino domfarolino left a comment

Choose a reason for hiding this comment

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

LGTM. I recommend we merge this in one week since I haven't seen any further objections, and I think it's ready to go.

This prevents authors from breaking accessibility
source Outdated
Comment on lines 138075 to 138076
min-block-size: max(24px, 1lh);
min-inline-size: 24px;
Copy link
Member

@nt1m nt1m Apr 8, 2025

Choose a reason for hiding this comment

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

I think @dbaron had thoughts on better defaults for these so they can work better in flexbox/grid

Copy link
Collaborator

@scottaohara scottaohara Apr 8, 2025

Choose a reason for hiding this comment

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

so long as the minimum sizing doesn't fall below 24px height/width. these were specifically added so that the customizable select would meet the WCAG 2.2 minimum target size success criterion by default.

text-transform: initial;
text-align: initial;
text-indent: initial;
background-color: transparent;
Copy link
Member

Choose a reason for hiding this comment

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

Chrome seems to set this to color-mix(in lab, currentColor 10%, transparent) in Forced colors mode. Should that be copied to this PR or should chrome actually just be keeping this as transparent?

Copy link
Member

Choose a reason for hiding this comment

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

Chrome also seems to set different values in forced colors mode for a few other properties too.

Such as the selects border both normally and on hover.

The hover background change for the options is also lost in forced colors mode too?

I think it would be good to define how all this is expected to work to ensure we're interopable in that mode too.

aarongable pushed a commit to chromium/chromium that referenced this pull request Apr 18, 2025
…id context.

This makes the change proposed in
w3c/csswg-drafts#12085

whatwg/html#10670 has been updated with this
change.

Change-Id: I046d73477e15ce6342f2c00193f8131d025c8e2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6462875
Reviewed-by: Joey Arhar <jarhar@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1448995}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Apr 18, 2025
…id context.

This makes the change proposed in
w3c/csswg-drafts#12085

whatwg/html#10670 has been updated with this
change.

Change-Id: I046d73477e15ce6342f2c00193f8131d025c8e2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6462875
Reviewed-by: Joey Arhar <jarhar@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1448995}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Apr 18, 2025
…id context.

This makes the change proposed in
w3c/csswg-drafts#12085

whatwg/html#10670 has been updated with this
change.

Change-Id: I046d73477e15ce6342f2c00193f8131d025c8e2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6462875
Reviewed-by: Joey Arhar <jarhar@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1448995}
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Apr 24, 2025
…select work better in flex/grid context., a=testonly

Automatic update from web-platform-tests
Make default min sizes for customizable select work better in flex/grid context.

This makes the change proposed in
w3c/csswg-drafts#12085

whatwg/html#10670 has been updated with this
change.

Change-Id: I046d73477e15ce6342f2c00193f8131d025c8e2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6462875
Reviewed-by: Joey Arhar <jarhar@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1448995}

--

wpt-commits: 0eb7694e58ce18fa3a1b130e4fe3fe65f2b3627c
wpt-pr: 52064
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements topic: forms topic: rendering topic: select The <select> element
8 participants