Re: [csswg-drafts] [css-ui] UA stylesheet for appearance:base `<select>` (#10857)

The CSS Working Group just discussed ``[css-ui] UA stylesheet for appearance:base `<select>` ``.

<details><summary>The full IRC log of that discussion</summary>
&lt;chrishtr> jarhar: have a list of additional properties proposed for the UA stylesheet. Think we should just go through them one-by-one.<br>
&lt;chrishtr> first rule: padding: 025em<br>
&lt;chrishtr> without this rule, the text in the button would stick to the borders, this centers it<br>
&lt;chrishtr> there is a caveat that it changes to 0 if the developer provides a child button element. That is there because if the the developer provides it, then we should just use that button and not add on extra box deccoration<br>
&lt;chrishtr> emilio: the select has a border right?<br>
&lt;chrishtr> jarhar: going to propose to remove the border actually<br>
&lt;chrishtr> jarhar: that way you don't have two borders<br>
&lt;chrishtr> jarhar: this was discussed on a separate issue with tim<br>
&lt;jensimmons> q+<br>
&lt;astearns> ack fantasai<br>
&lt;emilio> q+<br>
&lt;chrishtr> fantasai: what is the box model we're trying to style in this case? what boxes exist and what formatting context does it have? Is the select a bock box or a flexbox.<br>
&lt;chrishtr> jarhar: display: inline-block should answer that question (there is a proposed UA rule for it)<br>
&lt;chrishtr> fantasai: and it directly contains text? and if there is a provided button it shows the button?<br>
&lt;chrishtr> fantasai: there was a discussion about a pseudo elements, where did that go?<br>
&lt;chrishtr> jarhar: we decided not to have a fallback UA pseudo element in this case, and instead the select element itself should be it<br>
&lt;chrishtr> fantasai: if there is a button element, is block layout what you want for it? don't think so because we want the button to align with the border right?<br>
&lt;chrishtr> jarhar: yes<br>
&lt;chrishtr> jarhar: think we could do several adjustments if the button is there<br>
&lt;annevk> (display: contents might make focus funky too)<br>
&lt;chrishtr> fantasai: from an author's perspective should not see things change just because you added markup<br>
&lt;masonf> What if we add `select>button {border:0; padding:0}` instead? And leave select's borders and padding.<br>
&lt;emilio> `select > button { display: contents }`? :)<br>
&lt;astearns> ack jensimmons<br>
&lt;fantasai> or maybe select > button  { display: contents; }<br>
&lt;chrishtr> jensimmons: interesting that we have styling that depends on content<br>
&lt;chrishtr> jensimmons: don't know of another case that works that way<br>
&lt;chrishtr> jensimmons: not sure if authors would be confused by that or not<br>
&lt;chrishtr> jensimmons: for the sake of these conversations more visuals would be n ice<br>
&lt;astearns> q+<br>
&lt;chrishtr> jensimmons: don't know what to think right now but want to help get it done, there might be bikeshedding.<br>
&lt;masonf> Some common examples and use cases are detailed here: https://developer.chrome.com/blog/rfc-customizable-select<br>
&lt;chrishtr> jensimmons: can't tell<br>
&lt;astearns> ack emilio<br>
&lt;chrishtr> emilio: maybe the button shouldn't have decorations and should delegate that to the select element. display:contents on the button<br>
&lt;chrishtr> emilio: that may be a simpler option that avoids magic<br>
&lt;chrishtr> emilio: also have feedback on the min sizing<br>
&lt;keithamus> q+<br>
&lt;chrishtr> emilio: 24px may be too big<br>
&lt;chrishtr> emilio: white-space: normal seems find<br>
&lt;chrishtr> emilio: 2px block and 1px inline padding already exists?<br>
&lt;chrishtr> emilio: overall, the fewer rules the better<br>
&lt;chrishtr> emilio: display:contents could explain has behavior<br>
&lt;annevk> q+ to bring up the topic of how this relates to base styling of other controls<br>
&lt;masonf> q+<br>
&lt;chrishtr> emilio: maybe also make it !important<br>
&lt;astearns> ack fantasai<br>
&lt;chrishtr> fantasai: agree display: contents on the button make sense<br>
&lt;chrishtr> fantasai: no need for !important<br>
&lt;chrishtr> fantasai: considering pixel values for padding, I am in favor of em because it'll scale with font sizing<br>
&lt;chrishtr> fantasai: font-relative is good<br>
&lt;annevk> (.25em seems quite big, that's 4px)<br>
&lt;chrishtr> fantasai: not sure why 0.25, where did that come from?<br>
&lt;fantasai> s/0.25/1.2em/<br>
&lt;dbaron> many of these things are based on the existing UA stylesheet rules for &lt;select><br>
&lt;chrishtr> emilio: agree that em paddings are nicer. but also think that if we can avoid making different appearance:base specific CSS values that's better. the less differences the better.<br>
&lt;chrishtr> emilio: if existing padding is ok then let's try to accept it<br>
&lt;jarhar> q?<br>
&lt;jensimmons> q+<br>
&lt;chrishtr> astearns: uncomfortable with having a switch on select content that is not expressed in the UA stylesheet<br>
&lt;emilio> `select:has(> button) { ... }` should work<br>
&lt;chrishtr> astearns: if we have things in the UA style sheet that depends on some state we should avoid that and fix it<br>
&lt;astearns> ack astearns<br>
&lt;ntim> I like Elika's suggestion of making button display: contents<br>
&lt;annevk> (I agree with that to an extent, there's definitely things that are just not worth generalizing to CSS syntax.)<br>
&lt;jensimmons> Totally agree with Alan — secretly putting a switch to the styles in the engine is even more magical. It can totally be done in CSS.<br>
&lt;chrishtr> keithamus: in favor of the rule as it stands. 24px minimum size is useful. should consider a11y, and WCAG recommends that<br>
&lt;chrishtr> keithamus: I'd prefer even larger but smaller gets quite problematic<br>
&lt;masonf> Rule #3 here says we need to follow WCAG: https://github.com/w3c/csswg-drafts/issues/10866<br>
&lt;annevk> (E.g., detecting iso-8859-8-i.)<br>
&lt;chrishtr> keithamus: 0.25em is also good, a lot of design systems use it<br>
&lt;chrishtr> keithamus: need good defaults for modern-day practices and a11y practices. This is an opportunity to set good defaults.<br>
&lt;astearns> +1 to not always following current styling<br>
&lt;fantasai> strong +1 to keithamus<br>
&lt;chrishtr> keithamus: should avoid making it too complicated, but since it's easy for authors to customize it doesn't get in their way<br>
&lt;annevk> Can't it just be `select > button`?<br>
&lt;chrishtr> keithamus: display: contents is problematic, might be confusing to developers. also might have a11y problems<br>
&lt;chrishtr> keithamus: if you have a button in the select then probably the button should be in the AT, but if it's display:contents that would mess this up<br>
&lt;astearns> q?<br>
&lt;astearns> ack keithamus<br>
&lt;astearns> ack annevk<br>
&lt;Zakim> annevk, you wanted to bring up the topic of how this relates to base styling of other controls<br>
&lt;chrishtr> annevk: one meta point is that as we decide on these rules it'll have implications for base styles for other controls<br>
&lt;chrishtr> annevk: if we decide padding or sizing here then it should make sense for other controls<br>
&lt;chrishtr> annevk: don't want to have to revisit for other form controls<br>
&lt;chrishtr> annevk: with regards to display: contents, there are a lot of implications of display: contents for focus and so on that make it tricky<br>
&lt;chrishtr> annevk: if you just use a child selector then we could override its border and padding to be 0?<br>
&lt;emilio> So `select > button { appearance: none; padding: 0; border: 0 }`?<br>
&lt;chrishtr> annevk: if you're styling this button will its appearance be?<br>
&lt;astearns> ack masonf<br>
&lt;chrishtr> mason: one rule we're following is to follow WCAG, which is where 24px came from<br>
&lt;chrishtr> s/mason/masonry/<br>
&lt;chrishtr> s/mason/masonf/<br>
&lt;chrishtr> masonf: agree that we could have a rule like what Emilio wrote to remove appearance and put 0 padding  and border<br>
&lt;jensimmons> q-<br>
&lt;chrishtr> jarhar: the way we implemented it is that if the button is present then focus delegates to it, including focus rings<br>
&lt;chrishtr> jarhar: if there is no button then the select element itself gets the focus<br>
&lt;emilio> display: contents on the button seems like a nicer fix for the focus issue tbh :)<br>
&lt;emilio> q+<br>
&lt;chrishtr> masonf: others said let's inherit padding when possible from appearance: auto. I think we should fix them to be good.<br>
&lt;astearns> ack fantasai<br>
&lt;Zakim> fantasai, you wanted to disagree with emilio, our priority should be to be a good, accessible, interoperable base for styling, not consistent with existing styles<br>
&lt;annevk> I think if the `button` is being styled in the UA style sheet we need to figure out `appearance: base` for it.<br>
&lt;astearns> +1 to not making !important rules in the UA stylesheet if we can avoid it<br>
&lt;annevk> (I use webirc.w3.org and it keeps dropping me from the channel. I wish we'd use something that's not IRC.)<br>
&lt;chrishtr> fantasai: wanted to agree with Mason's sentiment that we should not optimize for avoiding rules that override auto, we should instead make a good and consistent base style without worrying about auto<br>
&lt;keithamus> q+<br>
&lt;chrishtr> fantasai: the button stuff sounds really confusing, since if you have a button you have to style that and not the select, and if not the select.<br>
&lt;chrishtr> fantasai: the button should be a markup extra that somehow doesn't need that complication<br>
&lt;astearns> ack emilio<br>
&lt;chrishtr> fantasai: if the purpose of the button is to clarify hierarchies then limit to that, and make it display: contents !important<br>
&lt;chrishtr> emilio: happy to concede on the padding<br>
&lt;fantasai> +1 emilio<br>
&lt;chrishtr> emilio: the focus shenanigans: display: contents would be simpler. then the rules for outlines would be simpler, since you'd always focus the select and not the button<br>
&lt;astearns> ack keithamus<br>
&lt;chrishtr> keithamus: one thing we might consider is that this is going to get integrated into sites that already have a lot of CSS, including around buttons<br>
&lt;chrishtr> keithamus: they will also have CSS around focus, active, etc<br>
&lt;masonf> q+<br>
&lt;chrishtr> keithamus: making the button a transparent part of the select might be a moot point, because the author is going to have button styling already in their theme, which they'd have to undo<br>
&lt;astearns> ack masonf<br>
&lt;chrishtr> masonf: following on that, if it was a custom element, you'd likely do the thing where you delegate styling. feels odd to have HTML that has a button and the button is not a regular button<br>
&lt;jarhar> q?<br>
&lt;chrishtr> masonf: display: contents seems weird from that perspective<br>
&lt;jarhar> q+<br>
&lt;ntim> q+<br>
&lt;astearns> ack jarhar<br>
&lt;annevk> What's the use case for the custom button? How does display: contents not invalidate that use case?<br>
&lt;chrishtr> jarhar: back when we were working on earlier iterations for this project, there was a way to put anything you want into the slot. now that I'm hearing people express concerns about different ways to handle this button, I'm thinking the original model was quite nice. could we go back to that?<br>
&lt;chrishtr> jarhar: we can't reuse the slot element, but maybe a new element or concept?<br>
&lt;jensimmons> No, we should use &lt;button> not a &lt;div> + new slot thing.<br>
&lt;chrishtr> annevk: the slot API is a web developer API.<br>
&lt;jensimmons> q+<br>
&lt;chrishtr> annevk: don't care about the button element that much, it's the content?<br>
&lt;chrishtr> annevk: maybe an appearance:base button could help?<br>
&lt;astearns> ack ntim<br>
&lt;chrishtr> ntim: before thinking about the styles with the button case, want to step back - what use cases will people use buttons for?<br>
&lt;chrishtr> ntim: if it's used for a split button then display: contents is probably not right<br>
&lt;keithamus> q+<br>
&lt;chrishtr> ntim: would be nice to see a list of use cases<br>
&lt;masonf> Some examples with custom buttons here: https://developer.chrome.com/blog/rfc-customizable-select<br>
&lt;chrishtr> jarhar: the main purpose of the button is to allow the developer to provide a way to put anything they want in the base element<br>
&lt;chrishtr> jarhar: a big use case is declaratively copying the selected option into the button<br>
&lt;chrishtr> jarhar: without providing them with a button, it precludes them putting their own or rich content into the in-page select element part<br>
&lt;chrishtr> jarhar: without doing this we'll miss most use cases<br>
&lt;masonf> q+<br>
&lt;chrishtr> ntim: does it allow for split buttons?<br>
&lt;chrishtr> jarhar: there has been a lot of discussion at OpenUI with experts<br>
&lt;annevk> q+ why do we need both button and selectedoption?<br>
&lt;annevk> q+ to ask why do we need both button and selectedoption?<br>
&lt;chrishtr> jarhar: split buttons have different a11y mapping, and they recommend using a completely different element for that, so split buttons is out of scope at the moment<br>
&lt;astearns> ack jensimmons<br>
&lt;chrishtr> jensimmons: an interesting thing about this project is understanding what it means to make a UA stylesheet. definitely think padding should be font-dependent. But if I we designing a design system I'd use line height units.<br>
&lt;chrishtr> jensimmons: we're trying to fix some decisions made back in the 90s<br>
&lt;annevk> q-<br>
&lt;chrishtr> jensimmons: we're not making the world's best design system though, just providing a base styling. might not be the perfect thing for them, but to find a way to match the new with the old<br>
&lt;chrishtr> jensimmons: without confusing authors<br>
&lt;astearns> ack keithamus<br>
&lt;chrishtr> keithamus: to extend on that point, we're not building this for people who are building on design systems or building a design system, these are defaults. design systems will very likely override most of these.<br>
&lt;chrishtr> keithamus: need to make sure it has accessible defaults, and that the styles aren't too difficult to override<br>
&lt;ntim> If the only use case is for the button is selectedoption, it makes sense to me from a styling perspective that button gets `display: contents`<br>
&lt;astearns> ack masonf<br>
&lt;fantasai> In that case, wouldn't you just style select { display: flex; } ?<br>
&lt;chrishtr> masonf: roughly +1 to what jen and keith said. agree authors will reset it. Minimal is better.<br>
&lt;chrishtr> masonf: we've been staring at this screen for an hour, but it's a quarter of the entire proposed style sheet<br>
&lt;chrishtr> masonf: suggest we iterate in the issue instead of live<br>
&lt;keithamus> it might be worth testing it against a bunch of popular CSS Reset libraries to ensure they don't break it in bad ways<br>
&lt;chrishtr> astearns: want to amplify Joey's point that the justification is in the comment, please reply on the issue<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10857#issuecomment-2462743355 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 7 November 2024 16:49:30 UTC